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

Function race

test/angular/1.5/angular.js:16945–16953  ·  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

16943 */
16944
16945 function race(promises) {
16946 var deferred = defer();
16947
16948 forEach(promises, function(promise) {
16949 when(promise).then(deferred.resolve, deferred.reject);
16950 });
16951
16952 return deferred.promise;
16953 }
16954
16955 function $Q(resolver) {
16956 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