提交 357e984b 编写于 作者: fxy060608's avatar fxy060608

fix #380

上级 f290bead
...@@ -56,16 +56,18 @@ export function promisify (name, api) { ...@@ -56,16 +56,18 @@ export function promisify (name, api) {
success: resolve, success: resolve,
fail: reject fail: reject
}), ...params) }), ...params)
/* eslint-disable no-extend-native */ /* eslint-disable no-extend-native */
Promise.prototype.finally = function (callback) { try {
const promise = this.constructor Promise.prototype.finally = function (callback) {
return this.then( const promise = this.constructor
value => promise.resolve(callback()).then(() => value), return this.then(
reason => promise.resolve(callback()).then(() => { value => promise.resolve(callback()).then(() => value),
throw reason reason => promise.resolve(callback()).then(() => {
}) throw reason
) })
} )
}
} catch (e) {}
})) }))
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册