diff options
author | 2023-06-27 18:18:04 -0400 | |
---|---|---|
committer | 2023-06-29 23:37:20 -0400 | |
commit | 4b27aaaac78de307f65a2e3359a0598363c25ad1 (patch) | |
tree | 9c5630734d5b69b6de763210dd39cc8a5faa45a2 /src/js/builtins/EventStream.ts | |
parent | 8fbf24fc2fcca36fa78f36c7fd21f729c46c5cdb (diff) | |
download | bun-4b27aaaac78de307f65a2e3359a0598363c25ad1.tar.gz bun-4b27aaaac78de307f65a2e3359a0598363c25ad1.tar.zst bun-4b27aaaac78de307f65a2e3359a0598363c25ad1.zip |
call cancel properly and lightly clean up ReadableStream
Diffstat (limited to 'src/js/builtins/EventStream.ts')
-rw-r--r-- | src/js/builtins/EventStream.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/js/builtins/EventStream.ts b/src/js/builtins/EventStream.ts index c82195eb2..c2ce30f17 100644 --- a/src/js/builtins/EventStream.ts +++ b/src/js/builtins/EventStream.ts @@ -12,17 +12,17 @@ export function getEventStream() { opts?.start?.(this); }, cancel: () => { - console.log("Cancel!"); opts?.cancel?.(this); + this.#ctrl = undefined; }, }); } send(event?: unknown, data?: unknown): void { var ctrl = this.#ctrl!; - // if (!ctrl) { - // throw new Error("EventStream has ended"); - // } + if (!ctrl) { + throw new Error("EventStream has ended"); + } if (!data) { data = event; event = undefined; |