deno.com

method Worker.terminate

#Worker.terminate(): void

Immediately terminates the worker. This does not offer the worker an opportunity to finish its operations; it is stopped at once.

Examples #

#
// Create a worker
const worker = new Worker(new URL("./worker.ts", import.meta.url).href, {
  type: "module"
});

// Some time later, when you're done with the worker
worker.terminate();
// The worker is now terminated and its resources are freed

Return Type #

void