Node.js Event Loop Visualizer

Interactive visualization of Node.js asynchronous execution model

Examples

Understanding execution order

Code Editor

Call Stack (Synchronous Code)

Empty

process.nextTick()

Highest priority - runs before microtasks

Empty

Microtask Queue

Promises - runs after nextTick

Empty

Event Loop Phases (libuv)

1. Timers

setTimeout, setInterval callbacks

Empty

2. Pending I/O

I/O callbacks deferred to next iteration

Empty

3. Poll

Retrieve new I/O events, execute callbacks

Empty

4. Check

setImmediate callbacks

Empty

5. Close

Close event callbacks (socket.on("close"))

Empty

Console Output

Waiting for execution...

Execution Order

  1. 1Synchronous code (Call Stack)
  2. 2process.nextTick() callbacks
  3. 3Promise microtasks
  4. 4Event Loop phases (Timers → Pending → Poll → Check → Close)

Key Differences from Browser

  • process.nextTick() - Node.js only, executes before any I/O
  • setImmediate() - Node.js only, runs after I/O events
  • Six distinct phases vs browser's simpler model
  • Built on libuv for cross-platform async I/O