mirror of
https://github.com/denoland/deno.git
synced 2024-11-05 09:04:41 -05:00
7966bf14c0
* split ops/worker.rs into ops/worker_host.rs and ops/web_worker.rs * refactor js/workers.ts and factor out js/worker_main.ts - entry point for WebWorker runtime * BREAKING CHANGE: remove support for blob: URL in Worker * BREAKING CHANGE: remove Deno namespace support and noDenoNamespace option in Worker constructor * introduce WebWorker struct which is a stripped down version of cli::Worker
23 lines
563 B
TypeScript
23 lines
563 B
TypeScript
const w1 = new Worker("./039_worker_deno_ns/has_ns.ts", { type: "module" });
|
|
const w2 = new Worker("./039_worker_deno_ns/no_ns.ts", { type: "module" });
|
|
let w1MsgCount = 0;
|
|
let w2MsgCount = 0;
|
|
w1.onmessage = (msg): void => {
|
|
console.log(msg.data);
|
|
w1MsgCount++;
|
|
if (w1MsgCount === 1) {
|
|
w1.postMessage("CONTINUE");
|
|
} else {
|
|
w2.postMessage("START");
|
|
}
|
|
};
|
|
w2.onmessage = (msg): void => {
|
|
console.log(msg.data);
|
|
w2MsgCount++;
|
|
if (w2MsgCount === 1) {
|
|
w2.postMessage("CONTINUE");
|
|
} else {
|
|
Deno.exit(0);
|
|
}
|
|
};
|
|
w1.postMessage("START");
|