Promise.allSettled() Pt.2 - it's partly settled!
It turns out there is a handy way to add
Promise.allSettled() to your apps right now! 🎉. It's fiendishly simple to use, too.
The core-js npm package
The latest ECMAScript standard.
ECMAScript standard library proposals.
Some WHATWG / W3C standards (cross-platform or closely related ECMAScript).
It is maximally modular: you can easily choose to load only the features you will be using.
It can be used without polluting the global namespace.
Promise.allSettled stage 2 proposal
Well hot damn! That'll do it!
How to use core-js
@j-f1 indicated, in any project that uses
babel as a transpiler, all you need to do is add core-js to your project, and include it at your app's entry point:
First, add the dependency to your project
> yarn add core-js
Then, at your app's entry point (usually something like
app.js in the root of your project):
or, if you want to include just the
Promise.allSettled() polyfill, and nothing else, use:
That's it! 🍻