js-visualizer-9000-client
js-visualizer-9000-client copied to clipboard
setTimeout and Task Queue
The callback function of setTimeout doesn't immediately enter the Task Queue. It only does so after the timer expires. However, in a web interface, this happens instantly, which is an error.
Good catch.
https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers Says
-
Set task's timer nesting level to nesting level.
-
Let completionStep be an algorithm step which queues a global task on the timer task source given global to run task.
-
Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and id.
I think what would be nice to have here is visualisation for map of active timers https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#map-of-active-timers