done.js 324 B

1234567891011121314
  1. 'use strict';
  2. var Promise = require('./core.js')
  3. var asap = require('asap')
  4. module.exports = Promise
  5. Promise.prototype.done = function (onFulfilled, onRejected) {
  6. var self = arguments.length ? this.then.apply(this, arguments) : this
  7. self.then(null, function (err) {
  8. asap(function () {
  9. throw err
  10. })
  11. })
  12. }