mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 22:20:27 +08:00
12 lines
213 B
JavaScript
12 lines
213 B
JavaScript
Promise.prototype.done = function (cb) {
|
|
let P = this.constructor;
|
|
|
|
return this.then(
|
|
(value) => P.resolve(cb()).then(() => value),
|
|
(reason) =>
|
|
P.resolve(cb()).then(() => {
|
|
throw reason;
|
|
})
|
|
);
|
|
};
|