Is it possible to cause Web Workers to Sleep?

Jivings picture Jivings · Feb 11, 2012 · Viewed 8k times · Source

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?

Answer

Sebastian Otto picture Sebastian Otto · Feb 11, 2012

setTimeoutand setInterval are available to web workers. So if you want to 'wait' your code this may be the best solution.