Files
remark42/web/app/promises.js
T
2018-01-06 11:58:24 +02:00

19 lines
530 B
JavaScript

import Promise from 'promise-polyfill';
/* eslint-disable no-underscore-dangle */
Promise._unhandledRejectionFn = () => {};
/* eslint-enable no-underscore-dangle */
/* eslint-disable no-extend-native */
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)
);
};
/* eslint-enable no-extend-native */
window.Promise = Promise;