Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed May 13, 2019
1 parent f290bea commit 357e984
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/core/helpers/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,18 @@ export function promisify (name, api) {
success: resolve,
fail: reject
}), ...params)
/* eslint-disable no-extend-native */
Promise.prototype.finally = function (callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
/* eslint-disable no-extend-native */
try {
Promise.prototype.finally = function (callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
} catch (e) {}
}))
}
}

0 comments on commit 357e984

Please sign in to comment.