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

Function race

lib/test/angular/1.7.0/angular.js:17650–17658  ·  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

17648 */
17649
17650 function race(promises) {
17651 var deferred = defer();
17652
17653 forEach(promises, function(promise) {
17654 when(promise).then(deferred.resolve, deferred.reject);
17655 });
17656
17657 return deferred.promise;
17658 }
17659
17660 function $Q(resolver) {
17661 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