mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
15 lines
338 B
TypeScript
15 lines
338 B
TypeScript
|
/// <reference no-default-lib="true" />
|
||
|
/// <reference lib="deno.worker" />
|
||
|
|
||
|
if (import.meta.main) {
|
||
|
console.log("Hello from worker!");
|
||
|
|
||
|
addEventListener("message", (evt) => {
|
||
|
console.log(`Received ${evt.data}`);
|
||
|
console.log("Closing");
|
||
|
self.close();
|
||
|
});
|
||
|
} else {
|
||
|
console.log("worker.js imported from main thread");
|
||
|
}
|