You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
437 B
21 lines
437 B
2 years ago
|
/**
|
||
|
* @this {Promise}
|
||
|
*/
|
||
|
function finallyConstructor(callback) {
|
||
|
var constructor = this.constructor;
|
||
|
return this.then(
|
||
|
function(value) {
|
||
|
return constructor.resolve(callback()).then(function() {
|
||
|
return value;
|
||
|
});
|
||
|
},
|
||
|
function(reason) {
|
||
|
return constructor.resolve(callback()).then(function() {
|
||
|
return constructor.reject(reason);
|
||
|
});
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default finallyConstructor;
|