Skip to content

Commit

Permalink
doc: fix process.nextTick() scheduling differences between module types
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Apr 13, 2023
1 parent 6fb74c7 commit d2ccc59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,8 @@ The [`queueMicrotask()`][] API is an alternative to `process.nextTick()` that
also defers execution of a function using the same microtask queue used to
execute the then, catch, and finally handlers of resolved promises. Within
Node.js, every time the "next tick queue" is drained, the microtask queue
is drained immediately after.
is drained immediately after. Note that `process.nextTick()` is scheduled
differently depending on the module type being used.
```mjs
import { nextTick } from 'node:process';
Expand All @@ -2543,9 +2544,9 @@ Promise.resolve().then(() => console.log(2));
queueMicrotask(() => console.log(3));
nextTick(() => console.log(1));
// Output:
// 1
// 2
// 3
// 1
```
```cjs
Expand Down

0 comments on commit d2ccc59

Please sign in to comment.