1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-30 11:16:38 -05:00
denoland-deno/cli/tests/testdata/worker_message_before_close.js

17 lines
434 B
JavaScript
Raw Normal View History

for (let i = 0; i < 4; i++) {
const worker = new Worker(
new URL("./workers/message_before_close.js", import.meta.url).href,
{ type: "module", name: String(i) },
);
worker.addEventListener("message", (message) => {
// Only print responses after all reception logs.
setTimeout(() => {
console.log("response from worker %d received", message.data);
}, 500);
});
worker.postMessage(i);
}
export {};