es.promise.reject.js 605 B

123456789101112131415
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var call = require('../internals/function-call');
  4. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  5. var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
  6. // `Promise.reject` method
  7. // https://tc39.es/ecma262/#sec-promise.reject
  8. $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
  9. reject: function reject(r) {
  10. var capability = newPromiseCapabilityModule.f(this);
  11. call(capability.reject, undefined, r);
  12. return capability.promise;
  13. }
  14. });