Web Workers are a way that JavaScript has to start running tasks on a new thread. This helps to offload some heavy processing for your web pages.
There are really only two things you need for web workers.
1. worker.postMessage( data )
2. worker.addEventListener('message', func)
If you need to shut down a worker you can call the self.close( ) method from within the worker or the worker.terminate( ) method from the initiating script.
HTML Code GIST: gist.github.co...
Worker script Code GIST: gist.github.co...
AJAX Playlist: • What is AJAX and Why S...
Promises Playlist: • JavaScript ES6 Promise...
8 сен 2024