source: imaps-frontend/node_modules/core-js/modules/es.promise.race.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.0 KB
Line 
1'use strict';
2var $ = require('../internals/export');
3var call = require('../internals/function-call');
4var aCallable = require('../internals/a-callable');
5var newPromiseCapabilityModule = require('../internals/new-promise-capability');
6var perform = require('../internals/perform');
7var iterate = require('../internals/iterate');
8var PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');
9
10// `Promise.race` method
11// https://tc39.es/ecma262/#sec-promise.race
12$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
13 race: function race(iterable) {
14 var C = this;
15 var capability = newPromiseCapabilityModule.f(C);
16 var reject = capability.reject;
17 var result = perform(function () {
18 var $promiseResolve = aCallable(C.resolve);
19 iterate(iterable, function (promise) {
20 call($promiseResolve, C, promise).then(capability.resolve, reject);
21 });
22 });
23 if (result.error) reject(result.value);
24 return capability.promise;
25 }
26});
Note: See TracBrowser for help on using the repository browser.