package.src.finally.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of promise-polyfill Show documentation
Show all versions of promise-polyfill Show documentation
Lightweight promise polyfill. A+ compliant
The newest version!
/**
* @this {Promise}
*/
function finallyConstructor(callback) {
var constructor = this.constructor;
return this.then(
function(value) {
// @ts-ignore
return constructor.resolve(callback()).then(function() {
return value;
});
},
function(reason) {
// @ts-ignore
return constructor.resolve(callback()).then(function() {
// @ts-ignore
return constructor.reject(reason);
});
}
);
}
export default finallyConstructor;