Node.js provides process.nextTick, which ensures that the called callback is invoked when control returns at runtime. This puts you at risk of starving an event loop, preventing the evaluation of jobs in the job queue.
Internet Explorer provides setImmediate, which, as far as I can tell, uses a separate task queue and some logic so that elements exit the queue once per iteration of the loop, excluding the "event loop puzzle".
requestAnimationFrame supports its own callback queue, which will be called one after another immediately before the VBLANK graphics subsystem.
Is it right to say that the JavaScript runtime coordinates the execution of tasks from different queues, putting them in an event loop for execution, from time to time determined by algorithms specific to these queues, and that in a sense, what happens is more that one event loop is serviced one job queue?
source
share