sleep()

This demo lets you try 3 different implementations of sleep() in a Web Worker.
The best is Atomics.wait(), followed by synchronous XHR + Service Worker.
A third simple while() loop implementation is provided for comparison.

Worker Status: ...
sleep(500) implementation:


The last 5 messages from the worker will be shown here.
View Source