Since web workers negate the disadvantages of paused execution in JavaScript, as they will not block UI, is there a reliable method to get them to Sleep
?
Either for a designated time, or until they receive a message?
Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface.
Objects such as window, document and parent can't be accessed inside the web worker.
Comlink-fetch allows you to use Fetch in a web worker that is exposed through Comlink.
setTimeout
and setInterval
are available to web workers. So if you want to 'wait' your code this may be the best solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With