setTimeout,
setInterval, I/O, UI events. Loop picks
ONE per iteration.
Promise.then,
queueMicrotask,
MutationObserver. Drains
fully after every macrotask.
requestAnimationFrame runs in its own
pre-render step.
nextTick and microtasks.
require('worker_threads'). Separate V8
instances for CPU-bound JS. Not the
libuv FS thread pool.
setTimeout/setInterval.
"0ms timer" runs at next loop tick.
setImmediate callbacks. Use to
defer until after I/O.
socket.on('close', ...).
Promise.then,
queueMicrotask. Drains right after
nextTick.
Watch how the browser and Node.js handle identical JavaScript. Pay attention to the moments where their output order diverges.
setImmediateWeb has no
setImmediate (non-standard). Try the
comparison and you'll see it ignored on the web
side.
process.nextTickWeb has no process. Calls would throw.
Only Node has this priority queue.