PaXa Labs / 16 · Interactive

Event Loop
Visualiser

PaXa Labs Event Loop Visualiser

Watch JavaScript tasks move through the call stack, async operations and queues one meaningful step at a time.

Fully client-side · Controlled scenarios · No eval()
Speed
ScenarioPromise vs setTimeout

Microtasks drain before eligible timer callbacks.

Expected outputA → D → C → B
Ready
Controlled example

Source Code

JavaScript
01console.log("A");02 03setTimeout(() => {04  console.log("B");05}, 0);06 07Promise.resolve().then(() => {08  console.log("C");09});10 11console.log("D");
Current pathCode → ready
Stack0
Async0
Microtasks0
Timers0
LIFO · main thread

Call Stack

0

Stack is empty

Timer registration

Async Operations

0

No operation waiting

Promises · await

Microtask Queue

0

No pending microtask

Eligible callbacks

Timer Queue

0

No eligible timer

Event LoopWaiting to run

It only moves eligible work when the call stack is empty.

Observed order

Console Output

0

Output appears here as each log statement executes.

Current step0 / 28

Ready. Run the scenario or advance one meaningful step at a time.

Readable sequence

Execution Log

0

Run or step through the scenario to build the log.

Illustrative, not profiling data

Simulation Timeline

SIM

Simulated timing appears as the execution advances.

What is the event loop?

One stack, several places to wait.

01Synchronous work

JavaScript executes the current synchronous task on one main call stack.

02Queued callbacks

Async operations register callbacks that become eligible for later execution.

03Microtask priority

When the stack clears, Promise and await microtasks are generally drained before timer callbacks.

Accuracy note: setTimeout(fn, 0) does not execute immediately. Its callback becomes eligible after the delay and still waits for the stack and pending microtasks. This visualiser uses a simplified educational model and does not run arbitrary JavaScript.