This is a ponyfill for Promise.allSettled.
It works like you would expect. It is safe so if Promise.allSettled ever gets added to JavaScript, it shouldn't break, of course assuming the one added supports the same way of handling promise resolution and rejection.
Promise.allSettled(promises)
.then((results) => {
results.forEach(function (result) {
if (result.state === "fulfilled") {
let value = result.value;
} else {
let reason = result.reason;
}
});
});
npm i es2015-promise.allsettled -S
bower install es2015-promise.allsettled -S
require('es2015-promise.allsettled');
import 'es2015-promise.allsettled'