UNPKG

1.12 kBTypeScriptView Raw
1import { OperatorFunction, ObservableInputTuple } from '../types';
2/**
3 * Creates an Observable that mirrors the first source Observable to emit a next,
4 * error or complete notification from the combination of the Observable to which
5 * the operator is applied and supplied Observables.
6 *
7 * ## Example
8 *
9 * ```ts
10 * import { interval } from 'rxjs';
11 * import { mapTo, raceWith } from 'rxjs/operators';
12 *
13 * const obs1 = interval(1000).pipe(mapTo('fast one'));
14 * const obs2 = interval(3000).pipe(mapTo('medium one'));
15 * const obs3 = interval(5000).pipe(mapTo('slow one'));
16 *
17 * obs2.pipe(
18 * raceWith(obs3, obs1)
19 * ).subscribe(
20 * winner => console.log(winner)
21 * );
22 *
23 * // Outputs
24 * // a series of 'fast one'
25 * ```
26 *
27 * @param otherSources Sources used to race for which Observable emits first.
28 * @return A function that returns an Observable that mirrors the output of the
29 * first Observable to emit an item.
30 */
31export declare function raceWith<T, A extends readonly unknown[]>(...otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;
32//# sourceMappingURL=raceWith.d.ts.map
\No newline at end of file