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

Function all

lib/test/angular/1.8.0/angular.js:18253–18273  ·  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

18251 */
18252
18253 function all(promises) {
18254 var result = new Promise(),
18255 counter = 0,
18256 results = isArray(promises) ? [] : {};
18257
18258 forEach(promises, function(promise, key) {
18259 counter++;
18260 when(promise).then(function(value) {
18261 results[key] = value;
18262 if (!(--counter)) resolvePromise(result, results);
18263 }, function(reason) {
18264 rejectPromise(result, reason);
18265 });
18266 });
18267
18268 if (counter === 0) {
18269 resolvePromise(result, results);
18270 }
18271
18272 return result;
18273 }
18274
18275 /**
18276 * @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