diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-04-10 00:15:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-10 00:15:17 +0200 |
commit | be71885628c3820cc4e62d229326de16a6830fec (patch) | |
tree | 664bac497658757a77b3d96cc71a1155613b20b1 /cli/js | |
parent | ac215a24613636b6e84b37a86dc4711dfaa4f2cc (diff) |
implement Worker.terminate() and self.close() (#4684)
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/web/workers.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/js/web/workers.ts b/cli/js/web/workers.ts index a62ca0b77..7a0abbbdb 100644 --- a/cli/js/web/workers.ts +++ b/cli/js/web/workers.ts @@ -127,6 +127,14 @@ export class WorkerImpl extends EventTarget implements Worker { const type = event.type; + if (type === "terminalError") { + this.#terminated = true; + if (!this.#handleError(event.error)) { + throw Error(event.error.message); + } + continue; + } + if (type === "msg") { if (this.onmessage) { const message = decodeMessage(new Uint8Array(event.data)); |