node:timers API Reference

Callback and Promise-based timer APIs

node:timers exports callback timers: setTimeout / clearTimeout, setInterval / clearInterval, and setImmediate / clearImmediate. They provide the same API as the timer globals, but are not the same JavaScript function objects. Legacy active() and unenroll() are not exposed.

node:timers/promises

ExportPurpose
setTimeout(delay?, value?, options?)Resolve with value after the delay.
setImmediate(value?, options?)Resolve on an immediate turn.
setInterval(delay?, value?, options?)Produce an async iterator.
schedulerProvides wait() and yield().

Promise timers accept an AbortSignal and reject with AbortError when it is aborted. Pending callback and Promise timers keep a standalone elide run process alive until they complete.

See also