ROS*

Engineering·  October 20, 2026·  4 min read

Waiting in the Callback Queue

The event loop never hurries. It finishes what is on the stack, then reaches for the next thing in line. There is a way of working hiding in that.

A line that never pushes

In JavaScript, a callback doesn’t run the moment its event fires. It joins a queue and waits until the call stack is empty. Only then does the event loop pick it up — one at a time, in order, without exception.

Nothing about this is clever. That’s what I like about it.

Ideas behave the same way

Most of what I write starts as a note that can’t be handled yet. The stack is full: a deadline, a bug, a meeting. So the idea goes into the queue.

The mistake is trying to run it immediately — half-finishing it between other things. It blocks everything and does justice to nothing.

Let the stack clear

  • Park it. Write down the idea in one sentence and leave it.
  • Finish what’s running. Context-switching is the most expensive operation there is.
  • Pick up the next one. When the stack is empty, take one item, not three.

The queue isn’t a backlog to feel guilty about. It’s a promise that each thing will get your whole attention, eventually.

javascriptevent looppatience
Next in the queueNine Colours, One Letter →