es.promise.with-resolvers.js 522 B

12345678910111213141516
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  4. // `Promise.withResolvers` method
  5. // https://tc39.es/ecma262/#sec-promise.withResolvers
  6. $({ target: 'Promise', stat: true }, {
  7. withResolvers: function withResolvers() {
  8. var promiseCapability = newPromiseCapabilityModule.f(this);
  9. return {
  10. promise: promiseCapability.promise,
  11. resolve: promiseCapability.resolve,
  12. reject: promiseCapability.reject
  13. };
  14. }
  15. });