Timers

timers/promises.setImmediate()

Returns a promise for an immediate callback; can be used to yield between finite work chunks.

Formal Syntax & Structure

nodejs syntaxnodejs
setImmediate([value[, options]])

Parameters & Attributes

NameTypeDescription
valueanyOptional fulfillment value.
optionsObjectOptional ref and signal settings.

Return Value

Promise

Fulfills with the supplied value or rejects on cancellation.

Working Example

Example Snippetnodejs
import { setImmediate } from 'node:timers/promises';console.log(await setImmediate('ready'));
Node.js Reference