diff options
author | andy finch <andyfinch7@gmail.com> | 2019-04-01 15:09:59 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-01 15:09:59 -0400 |
commit | b0a23beb8fae964be3cdd8c23c38af66257d34c7 (patch) | |
tree | 8f7875c8ca059dfb0a3ade4da7bfb94e57d6e1aa /tests/026_workers.ts | |
parent | 659acadf77fdbeef8579a37839a464feb408437a (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.ts | 14 |
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"); |