MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / race

Function race

lib/test/angular/1.6.7/angular.js:17421–17429  ·  view source on GitHub ↗

* @ngdoc method * @name $q#race * @kind function * * @description * Returns a promise that resolves or rejects as soon as one of those promises * resolves or rejects, with the value or reason from that promise. * * @param {Array. |Object. } promises An array o

(promises)

Source from the content-addressed store, hash-verified

17419 */
17420
17421 function race(promises) {
17422 var deferred = defer();
17423
17424 forEach(promises, function(promise) {
17425 when(promise).then(deferred.resolve, deferred.reject);
17426 });
17427
17428 return deferred.promise;
17429 }
17430
17431 function $Q(resolver) {
17432 if (!isFunction(resolver)) {

Callers

nothing calls this directly

Calls 3

deferFunction · 0.70
forEachFunction · 0.70
whenFunction · 0.70

Tested by

no test coverage detected