Timers

The setTimeout, setInterval, setImmediate, and queueMicrotask globals.

setTimeout, setInterval, setImmediate, their clear* counterparts, and queueMicrotask are globals.

Differences from browsers

  • Timers return Node Timeout or Immediate objects, not numbers, with ref(), unref(), hasRef(), and refresh() (Timeout only).
  • String handlers are not supported; the callback must be callable.
  • At a checkpoint, callbacks run in this order:
    1. process.nextTick
    2. Promise and queueMicrotask callbacks, in enqueue order
    3. setImmediate
    4. Zero-delay timers