setTimeout, setInterval, setImmediate, their clear* counterparts, and queueMicrotask are globals.
Differences from browsers
- Timers return Node
TimeoutorImmediateobjects, not numbers, withref(),unref(),hasRef(), andrefresh()(Timeoutonly). - String handlers are not supported; the callback must be callable.
- At a checkpoint, callbacks run in this order:
process.nextTick- Promise and
queueMicrotaskcallbacks, in enqueue order setImmediate- Zero-delay timers