feross/queue-microtask — explained in plain English
Analysis updated 2026-07-17 · repo last pushed 2023-11-30
Defer a small piece of code to run right after the current task without using slower setTimeout delays.
Add microtask scheduling to a library that must run consistently across old and new Node.js versions and browsers.
Keep bundle size minimal in a cross-platform JS library while still supporting environments lacking native queueMicrotask.
Flush a batch of pending updates immediately after the current synchronous code finishes.
| feross/queue-microtask | gaearon/react-transform-catch-errors | jianshuo/ccglass | |
|---|---|---|---|
| Stars | 189 | 183 | 181 |
| Language | JavaScript | JavaScript | JavaScript |
| Last pushed | 2023-11-30 | 2016-04-18 | — |
| Maintenance | Dormant | Dormant | — |
| Setup difficulty | easy | easy | easy |
| Complexity | 1/5 | 2/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
When you write JavaScript, sometimes you need to schedule a small piece of code to run "very soon", not immediately, but right after the current task finishes, before the browser or server moves on to other work. The modern standard way to do this is a built-in function called queueMicrotask. The queue-microtask package lets developers use this function safely across all modern JavaScript environments, even older versions of Node.js and browsers that don't support it natively yet. Under the hood, if the JavaScript engine already supports queueMicrotask, the package just uses it directly. If it doesn't, the package falls back to using Promise.resolve().then(fn), which achieves the same effect with the same performance. The entire implementation is under ten lines of code with zero dependencies, so it adds almost no weight to your project. This package is for developers building JavaScript applications who want to keep their bundle size as small as possible while still supporting a wide range of environments. For example, if you're building a library that runs in both the browser and Node.js and you need to defer a quick task, like flushing a batch of updates, without the heavy delays of setTimeout, this package handles the inconsistency across platforms for you. If you only need to support Node 12 and later, you don't need this package at all, you can use the built-in function directly. What stands out about this project is its extreme minimalism and the deliberate tradeoff it makes. Other libraries that solve similar problems exist and support very old browsers, but they come with extra code and larger file sizes. This package intentionally skips support for ancient environments lacking Promise support, choosing instead to stay as tiny as possible while delivering optimal performance for the vast majority of users on modern engines.
A tiny JavaScript package that safely schedules code to run right after the current task finishes, using the native queueMicrotask when available and falling back to Promise-based code otherwise.
Mainly JavaScript. The stack also includes JavaScript.
Dormant — no commits in 2+ years (last push 2023-11-30).
No license information was mentioned in the explanation.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
double-check against the repo, no cap.