add finally polyfill for promises

This commit is contained in:
igoradamenko
2018-06-30 23:56:52 +03:00
parent 6a4067d6e6
commit ed92a0bda5
3 changed files with 2902 additions and 2887 deletions
+12
View File
@@ -1,5 +1,17 @@
import 'core-js/es6/promise';
// default promise polyfill doesn't include finally
Promise.prototype.finally = function finallyFn(callback) {
const constructor = this.constructor;
return this.then(
(value) => constructor.resolve(callback()).then(() => value),
(reason) => constructor.resolve(callback()).then(() => reason)
);
};
window.Promise = Promise;
export default function loadPolyfills() {
const fillCoreJs = () => {
if (
+2887 -2886
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -44,7 +44,9 @@
"bem-react-helper": "^1.1.2",
"preact": "^8.2.9"
},
"eslintIgnore": ["public"],
"eslintIgnore": [
"public"
],
"jest": {
"transform": {
"^.+\\.jsx?$": "<rootDir>/fileTransformer.js"