queueMicrotask()

A standard function that schedules a callback as a microtask, the same queue promise callbacks use.

In more detail

The callback runs right after the current code finishes and before any timer or rendering, the same timing as a resolved promise callback but without creating a promise. It works in browsers and Node.js alike; in Node.js it runs after any process.nextTick() callbacks already queued. Use it sparingly, because a microtask that queues another delays rendering.

Related terms

Taught in

References