summaryrefslogtreecommitdiff
path: root/tests/026_workers.ts
diff options
context:
space:
mode:
authorandy finch <andyfinch7@gmail.com>2019-04-01 15:09:59 -0400
committerRyan Dahl <ry@tinyclouds.org>2019-04-01 15:09:59 -0400
commitb0a23beb8fae964be3cdd8c23c38af66257d34c7 (patch)
tree8f7875c8ca059dfb0a3ade4da7bfb94e57d6e1aa /tests/026_workers.ts
parent659acadf77fdbeef8579a37839a464feb408437a (diff)
Add web worker JS API (#1993)
* Refactored the way worker polling is scheduled and errors are handled. * Share the worker future as a Shared
Diffstat (limited to 'tests/026_workers.ts')
-rw-r--r--tests/026_workers.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/026_workers.ts b/tests/026_workers.ts
new file mode 100644
index 000000000..0cf8f53b1
--- /dev/null
+++ b/tests/026_workers.ts
@@ -0,0 +1,14 @@
+const jsWorker = new Worker("tests/subdir/test_worker.js");
+const tsWorker = new Worker("tests/subdir/test_worker.ts");
+
+tsWorker.onmessage = e => {
+ console.log("Received ts: " + e.data);
+};
+
+jsWorker.onmessage = e => {
+ console.log("Received js: " + e.data);
+
+ tsWorker.postMessage("Hello World");
+};
+
+jsWorker.postMessage("Hello World");