JavaScript Workers Terminate a worker

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Once you are done with a worker you should terminate it. This helps to free up resources for other applications on the user’s computer.

Main Thread:

// Terminate a worker from your application.
worker.terminate();

Note: The terminate method is not available for service workers. It will be terminated when not in use, and restarted when it's next needed.

Worker Thread:

// Have a worker terminate itself.
self.close();


Got any JavaScript Question?