Skip to content

Commit d2ccc59

Browse files
committed
doc: fix process.nextTick() scheduling differences between module types
1 parent 6fb74c7 commit d2ccc59

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/process.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,7 +2534,8 @@ The [`queueMicrotask()`][] API is an alternative to `process.nextTick()` that
25342534
also defers execution of a function using the same microtask queue used to
25352535
execute the then, catch, and finally handlers of resolved promises. Within
25362536
Node.js, every time the "next tick queue" is drained, the microtask queue
2537-
is drained immediately after.
2537+
is drained immediately after. Note that `process.nextTick()` is scheduled
2538+
differently depending on the module type being used.
25382539
25392540
```mjs
25402541
import { nextTick } from 'node:process';
@@ -2543,9 +2544,9 @@ Promise.resolve().then(() => console.log(2));
25432544
queueMicrotask(() => console.log(3));
25442545
nextTick(() => console.log(1));
25452546
// Output:
2546-
// 1
25472547
// 2
25482548
// 3
2549+
// 1
25492550
```
25502551
25512552
```cjs

0 commit comments

Comments
 (0)