summaryrefslogtreecommitdiff
path: root/cli/tests/039_worker_deno_ns.ts
blob: 7cb7de7fbd05ea33f8df4bf5ef85010d8dd2492b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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");