polyfill-done.js 350 B

123456789101112
  1. // should work in any browser without browserify
  2. if (typeof Promise.prototype.done !== 'function') {
  3. Promise.prototype.done = function (onFulfilled, onRejected) {
  4. var self = arguments.length ? this.then.apply(this, arguments) : this
  5. self.then(null, function (err) {
  6. setTimeout(function () {
  7. throw err
  8. }, 0)
  9. })
  10. }
  11. }