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