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

Function race

test/angular/1.6/angular.js:17606–17614  ·  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

17604 */
17605
17606 function race(promises) {
17607 var deferred = defer();
17608
17609 forEach(promises, function(promise) {
17610 when(promise).then(deferred.resolve, deferred.reject);
17611 });
17612
17613 return deferred.promise;
17614 }
17615
17616 function $Q(resolver) {
17617 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