Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
584 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var aFunction = require('../internals/a-function');
|
---|
3 |
|
---|
4 | var PromiseCapability = function (C) {
|
---|
5 | var resolve, reject;
|
---|
6 | this.promise = new C(function ($$resolve, $$reject) {
|
---|
7 | if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
---|
8 | resolve = $$resolve;
|
---|
9 | reject = $$reject;
|
---|
10 | });
|
---|
11 | this.resolve = aFunction(resolve);
|
---|
12 | this.reject = aFunction(reject);
|
---|
13 | };
|
---|
14 |
|
---|
15 | // `NewPromiseCapability` abstract operation
|
---|
16 | // https://tc39.es/ecma262/#sec-newpromisecapability
|
---|
17 | module.exports.f = function (C) {
|
---|
18 | return new PromiseCapability(C);
|
---|
19 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.