Skip to content

Commit

Permalink
fix: 兼容finally
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Sep 18, 2020
1 parent b325903 commit ce959f7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/d2-crud-plus/src/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
import d2CrudPlus from './install'
import './styles/d2-crud-plus.scss'

if (Promise && !Promise.prototype.finally) {
console.log('shim finally')
// eslint-disable-next-line no-extend-native
Promise.prototype.finally = {
finally (fn) {
const onFinally = callback => Promise.resolve(fn()).then(callback)
return this.then(
result => onFinally(() => result),
reason => onFinally(() => Promise.reject(reason))
)
}
}
}

export { d2CrudPlus }

0 comments on commit ce959f7

Please sign in to comment.