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
| Name | Type | Description |
|---|---|---|
| value | any | Optional fulfillment value. |
| options | Object | Optional 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'));