On this page
Global.queueMicrotask
Prev: encodeURIComponent | Up: Global | Next: globalThis
Rel: Global, JS Core Syntax & Types
Ref: MDN Web Docs — Global.queueMicrotask
Tags: #public #web #javascript #builtins #global #tier/standard
Signature & Overview
queueMicrotask(callback)
Schedules callback on the microtask queue right after the current call stack empties (before rendering/timers).
Notes & Pitfalls
- Runs after the current synchronous call stack, BEFORE the next macrotask (
setTimeout) or repaint: Don't queue microtasks recursively forever or you'll starve rendering/timers.
Example
const log = [];
queueMicrotask(() => log.push("micro"));
log.push("sync");
// After current tick: log is ["sync", "micro"]
Linked from
Related notes
- tuts/javascript/builtins/Global/encodeURIComponent Linked here; links to this page; shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/globalThis Linked here; links to this page; shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global Linked here; links to this page; shared tags: #builtins, #global, #javascript, #web
- tuts/javascript/tutorials/core_syntax_and_types Linked here; shared tags: #javascript, #web
- tuts/javascript/builtins/Global/isNaN shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/Number_isNaN shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/parseInt shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Global/structuredClone shared tags: #builtins, #global, #javascript, #tier, #web
- tuts/javascript/builtins/Array/at shared tags: #builtins, #javascript, #tier, #web
- tuts/javascript/builtins/Array/filter shared tags: #builtins, #javascript, #tier, #web