source: trip-planner-front/node_modules/rxjs/src/internal/operators/race.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.9 KB
Line 
1import { Observable } from '../Observable';
2import { isArray } from '../util/isArray';
3import { MonoTypeOperatorFunction, OperatorFunction } from '../types';
4import { race as raceStatic } from '../observable/race';
5
6/* tslint:disable:max-line-length */
7/** @deprecated Deprecated in favor of static race. */
8export function race<T>(observables: Array<Observable<T>>): MonoTypeOperatorFunction<T>;
9/** @deprecated Deprecated in favor of static race. */
10export function race<T, R>(observables: Array<Observable<T>>): OperatorFunction<T, R>;
11/** @deprecated Deprecated in favor of static race. */
12export function race<T>(...observables: Array<Observable<T> | Array<Observable<T>>>): MonoTypeOperatorFunction<T>;
13/** @deprecated Deprecated in favor of static race. */
14export function race<T, R>(...observables: Array<Observable<any> | Array<Observable<any>>>): OperatorFunction<T, R>;
15/* tslint:enable:max-line-length */
16
17/**
18 * Returns an Observable that mirrors the first source Observable to emit a next,
19 * error or complete notification from the combination of this Observable and supplied Observables.
20 * @param {...Observables} ...observables Sources used to race for which Observable emits first.
21 * @return {Observable} An Observable that mirrors the output of the first Observable to emit an item.
22 * @method race
23 * @owner Observable
24 * @deprecated Deprecated in favor of static {@link race}.
25 */
26export function race<T>(...observables: (Observable<T> | Observable<T>[])[]): MonoTypeOperatorFunction<T> {
27 return function raceOperatorFunction(source: Observable<T>) {
28 // if the only argument is an array, it was most likely called with
29 // `pair([obs1, obs2, ...])`
30 if (observables.length === 1 && isArray(observables[0])) {
31 observables = observables[0] as Observable<T>[];
32 }
33
34 return source.lift.call(raceStatic(source, ...(observables as Observable<T>[])));
35 };
36}
Note: See TracBrowser for help on using the repository browser.