Files
remark42/web/app/common/promises.js
T
2018-03-26 14:30:26 +03:00

15 lines
372 B
JavaScript

import Promise from 'promise-polyfill';
Promise._unhandledRejectionFn = () => {};
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;