birdofpreyru/react-global-state

Promise is not polyfilled for IE

Closed this issue · 0 comments

This code crashes in IE due to Promise being not defined.

/* TODO: This is a temporary polyfill for `Promise.allSettled(..)` method,
* which is supported natively by NodeJS >= v12.9.0. As earlier NodeJS version
* are still in a wide use, this polyfill is added here, and it is to be dropped
* some time later. */
if (!Promise.allSettled) {
Promise.allSettled = (promises) => Promise.all(
promises.map((p) => (p instanceof Promise ? p.finally(() => null) : p)),
);
}