1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-20 14:24:48 -05:00
denoland-deno/tests/testdata/workers/node_worker_auto_exits.mjs

10 lines
281 B
JavaScript
Raw Normal View History

import { isMainThread, Worker } from "node:worker_threads";
if (isMainThread) {
// This re-loads the current file inside a Worker instance.
const w = new Worker(import.meta.filename);
} else {
console.log("Inside Worker!");
console.log(isMainThread); // Prints 'false'.
}