On this page
  1. Global.queueMicrotask
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

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

Example

const log = [];
queueMicrotask(() => log.push("micro"));
log.push("sync");
// After current tick: log is ["sync", "micro"]

Linked from

Related notes