summaryrefslogtreecommitdiff
path: root/js/globals.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-01-08 14:44:06 -0500
committerGitHub <noreply@github.com>2019-01-08 14:44:06 -0500
commit6f79ad721a9f8c9d66d79f21ea479286f3ca5374 (patch)
tree3f8bad38a5bc109586d86846cb299717b425cdba /js/globals.ts
parent9ff6bca86388dab2cfa26e1712822f105985425e (diff)
Minimal Worker support (#1476)
This adds the ability to spawn additional Isolates from Rust and send and receive messages from them. This is preliminary work to support running the typescript compiler in a separate isolate and thus support native ES modules. Ref #975.
Diffstat (limited to 'js/globals.ts')
-rw-r--r--js/globals.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/js/globals.ts b/js/globals.ts
index 663215341..849d2bb3f 100644
--- a/js/globals.ts
+++ b/js/globals.ts
@@ -19,6 +19,7 @@ import * as textEncoding from "./text_encoding";
import * as timers from "./timers";
import * as url from "./url";
import * as urlSearchParams from "./url_search_params";
+import * as workers from "./workers";
// These imports are not exposed and therefore are fine to just import the
// symbols required.
@@ -86,3 +87,8 @@ window.TextEncoder = textEncoding.TextEncoder;
export type TextEncoder = textEncoding.TextEncoder;
window.TextDecoder = textEncoding.TextDecoder;
export type TextDecoder = textEncoding.TextDecoder;
+
+window.workerMain = workers.workerMain;
+// TODO These shouldn't be available in main isolate.
+window.postMessage = workers.postMessage;
+window.close = workers.workerClose;