main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
618 bytes
|
Line | |
---|
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 | // `NewPromiseCapability` abstract operation
|
---|
18 | // https://tc39.es/ecma262/#sec-newpromisecapability
|
---|
19 | module.exports.f = function (C) {
|
---|
20 | return new PromiseCapability(C);
|
---|
21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.