queue-microtask
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "queue-microtask", | ||
"description": "fast, tiny `queueMicrotask` shim for modern engines", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh", |
@@ -14,8 +14,7 @@ # queue-microtask [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] | ||
- Use [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) in all JS engines. | ||
- Use [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) in all modern JS engines. | ||
- No dependencies. Less than 10 lines. No shims or complicated fallbacks. | ||
- Optimal performance in all modern environments. | ||
- Use `queueMicrotask` in modern environments (optimal) | ||
- Fallback to `Promise.resolve().then(fn)` in Node.js 10 and earlier, and old browsers (optimal) | ||
- Fallback to `setTimeout` in JS environments without `Promise` (slow) | ||
- Uses `queueMicrotask` in modern environments (optimal performance) | ||
- Fallback to `Promise.resolve().then(fn)` in Node.js 10 and earlier, and old browsers (optimal performance) | ||
@@ -50,3 +49,3 @@ ## install | ||
This package allows you to use `queueMicrotask` safely in all JS engines. Use it if you prioritize small JS bundle size over optimal performance in old browsers. | ||
This package allows you to use `queueMicrotask` safely in all modern JS engines. Use it if you prioritize small JS bundle size over support for old browsers. | ||
@@ -69,5 +68,5 @@ ## Why not use `process.nextTick`? | ||
Note: This package does not have proper microtask support in old browsers. Instead, old browsers fallback to `setTimeout`. This will be slower, but it allows us to avoid including a complicated solution. | ||
Note: This package throws an exception in JS environments which lack `Promise` support -- which are usually very old browsers and Node.js versions. | ||
Since the `queueMicrotask` API is supported in Chrome, Firefox, Safari, Opera, and Edge, **the vast majority of users will get the optimal experience**. Any JS environment with `Promise`, which is almost all of them, also get the optimal experience. If you need optimal performance in old browsers, use one of the alternative packages. | ||
Since the `queueMicrotask` API is supported in Node.js, Chrome, Firefox, Safari, Opera, and Edge, **the vast majority of users will get optimal performance**. Any JS environment with `Promise`, which is almost all of them, also get optimal performance. If you need support for JS environments which lack `Promise` support, use one of the alternative packages. | ||
@@ -74,0 +73,0 @@ ## What is a shim? |
8161
89