web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
522 B

  1. 'use strict';
  2. var aFunction = require('../internals/a-function');
  3. var PromiseCapability = function (C) {
  4. var resolve, reject;
  5. this.promise = new C(function ($$resolve, $$reject) {
  6. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  7. resolve = $$resolve;
  8. reject = $$reject;
  9. });
  10. this.resolve = aFunction(resolve);
  11. this.reject = aFunction(reject);
  12. };
  13. // 25.4.1.5 NewPromiseCapability(C)
  14. module.exports.f = function (C) {
  15. return new PromiseCapability(C);
  16. };