Language concepts
process.nextTick()
Node-specific queue for callbacks before continuing host event-loop processing at relevant boundaries. Ordering relative to promise microtasks depends on execution context; recursive next ticks can starve later work. Multi-file example: save each listed file separately, then run the entry file with Node.js. See the packaged fixture for the original files.
Formal Syntax & Structure
javascript syntaxjavascript
process.nextTick(callback, ...args)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| callback | function | Callback to invoke. |
| args | any[] | Arguments forwarded to the callback. |
Return Value
undefined
No return value.
Working Example
Example Snippetjavascript
// File: main.cjsprocess.nextTick(()=>console.log("tick"));queueMicrotask(()=>console.log("micro"));console.log("sync");