UNPKG

1.09 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, map, raceWith } from 'rxjs';
11 *
12 * const obs1 = interval(7000).pipe(map(() => 'slow one'));
13 * const obs2 = interval(3000).pipe(map(() => 'fast one'));
14 * const obs3 = interval(5000).pipe(map(() => 'medium one'));
15 *
16 * obs1
17 * .pipe(raceWith(obs2, obs3))
18 * .subscribe(winner => console.log(winner));
19 *
20 * // Outputs
21 * // a series of 'fast one'
22 * ```
23 *
24 * @param otherSources Sources used to race for which Observable emits first.
25 * @return A function that returns an Observable that mirrors the output of the
26 * first Observable to emit an item.
27 */
28export declare function raceWith<T, A extends readonly unknown[]>(...otherSources: [...ObservableInputTuple<A>]): OperatorFunction<T, T | A[number]>;
29//# sourceMappingURL=raceWith.d.ts.map
\No newline at end of file