From d2ccc59defee7307e4b52bff32cf5e1eeefae25d Mon Sep 17 00:00:00 2001 From: Daniel Nalborczyk Date: Thu, 20 Oct 2022 10:27:12 -0400 Subject: [PATCH] doc: fix process.nextTick() scheduling differences between module types --- doc/api/process.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 6a82db4d64142a..2a3547b89b3f98 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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'; @@ -2543,9 +2544,9 @@ Promise.resolve().then(() => console.log(2)); queueMicrotask(() => console.log(3)); nextTick(() => console.log(1)); // Output: -// 1 // 2 // 3 +// 1 ``` ```cjs