function setImmediate
Jump to headingsetImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void,...args: TArgs,): Immediate
Schedules the "immediate" execution of the callback
after I/O events'
callbacks.
When multiple calls to setImmediate()
are made, the callback
functions are
queued for execution in the order in which they are created. The entire callback
queue is processed every event loop iteration. If an immediate timer is queued
from inside an executing callback, that timer will not be triggered until the
next event loop iteration.
If callback
is not a function, a TypeError
will be thrown.
This method has a custom variant for promises that is available using timersPromises.setImmediate()
.
Type Parameters Jump to heading
Jump to headingTArgs extends any[]
Parameters Jump to heading
Jump to headingcallback: (...args: TArgs) => void
The function to call at the end of this turn of the Node.js Event Loop
Jump to heading<span>...args</span>: TArgs
Return Type Jump to heading
for use with clearImmediate
Jump to headingsetImmediate(callback: (args: void) => void): Immediate
Parameters Jump to heading
Jump to headingcallback: (args: void) => void