aboutsummaryrefslogtreecommitdiff
path: root/src/js/builtins/EventStream.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/builtins/EventStream.ts')
-rw-r--r--src/js/builtins/EventStream.ts8
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;