summaryrefslogtreecommitdiff
path: root/cli/tests/workers_basic.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-02-05 17:16:07 -0500
committerGitHub <noreply@github.com>2020-02-05 17:16:07 -0500
commited680552a24b7d4b936b7c16a63b46e0f24c0e60 (patch)
tree176874e2e69ad631885d306ac7d1084b43459f1e /cli/tests/workers_basic.ts
parent700f5e45ef0af01558d7619e9ca08ae130ca7263 (diff)
fix: basic web worker message passing (#3893)
Removes OP_HOST_GET_WORKER_LOADED, OP_HOST_POLL_WORKER, OP_HOST_RESUME_WORKER and ready/messageBuffer in cli/js/workers.ts.
Diffstat (limited to 'cli/tests/workers_basic.ts')
-rw-r--r--cli/tests/workers_basic.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/tests/workers_basic.ts b/cli/tests/workers_basic.ts
new file mode 100644
index 000000000..64bd58fcc
--- /dev/null
+++ b/cli/tests/workers_basic.ts
@@ -0,0 +1,11 @@
+// Tests basic postMessage, close, onmessage
+const jsWorker = new Worker("./subdir/test_worker_basic.js", {
+ type: "module",
+ name: "jsWorker"
+});
+
+jsWorker.onmessage = (e): void => {
+ console.log("main recv: " + e.data);
+};
+
+jsWorker.postMessage("msg1");