MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / all

Function all

lib/test/angular/1.7.0/angular.js:17614–17634  ·  view source on GitHub ↗

* @ngdoc method * @name $q#all * @kind function * * @description * Combines multiple promises into a single promise that is resolved when all of the input * promises are resolved. * * @param {Array. |Object. } promises An array or hash of promises. * @retur

(promises)

Source from the content-addressed store, hash-verified

17612 */
17613
17614 function all(promises) {
17615 var result = new Promise(),
17616 counter = 0,
17617 results = isArray(promises) ? [] : {};
17618
17619 forEach(promises, function(promise, key) {
17620 counter++;
17621 when(promise).then(function(value) {
17622 results[key] = value;
17623 if (!(--counter)) resolvePromise(result, results);
17624 }, function(reason) {
17625 rejectPromise(result, reason);
17626 });
17627 });
17628
17629 if (counter === 0) {
17630 resolvePromise(result, results);
17631 }
17632
17633 return result;
17634 }
17635
17636 /**
17637 * @ngdoc method

Callers

nothing calls this directly

Calls 5

isArrayFunction · 0.70
forEachFunction · 0.70
whenFunction · 0.70
resolvePromiseFunction · 0.70
rejectPromiseFunction · 0.70

Tested by

no test coverage detected