Stop Web Workers in HTML5

JavascriptWeb DevelopmentFront End Scripts

Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions and allows long tasks to be executed without yielding to keep the page responsive.

Web Workers don't stop by themselves but the page that started them can stop them by calling terminate() method.

worker.terminate();

A terminated Web Worker will no longer respond to messages or perform any additional computations. You cannot restart a worker; instead, you can create a new worker using the same URL.

raja
Published on 06-Apr-2018 17:48:30
Advertisements