function
stable
Returns an Observable that mirrors the first source Observable to emit an item.
race<T>(...observables: ObservableInput<any>[]): Observable<T>
observables | Type: |
Observable<T>
: an Observable that mirrors the output of the first Observable to emit an item.
import { race, interval } from 'rxjs'; import { mapTo } from 'rxjs/operators'; const obs1 = interval(1000).pipe(mapTo('fast one')); const obs2 = interval(3000).pipe(mapTo('medium one')); const obs3 = interval(5000).pipe(mapTo('slow one')); race(obs3, obs1, obs2) .subscribe( winner => console.log(winner) ); // result: // a series of 'fast one'
race(arg: [ObservableInput<A>]): Observable<A>
arg |
Observable<A>
race(arg: [ObservableInput<A>, ObservableInput<B>]): Observable<A | B>
arg | Type: |
Observable<A | B>
race(arg: [ObservableInput<A>, ObservableInput<B>, ObservableInput<C>]): Observable<A | B | C>
arg | Type: |
Observable<A | B | C>
race(arg: [ObservableInput<A>, ObservableInput<B>, ObservableInput<C>, ObservableInput<D>]): Observable<A | B | C | D>
arg | Type: |
Observable<A | B | C | D>
race(arg: [ObservableInput<A>, ObservableInput<B>, ObservableInput<C>, ObservableInput<D>, ObservableInput<E>]): Observable<A | B | C | D | E>
arg | Type: |
Observable<A | B | C | D | E>
race(arg: ObservableInput<T>[]): Observable<T>
arg | Type: |
Observable<T>
race(arg: ObservableInput<any>[]): Observable<{
}>
arg | Type: |
Observable<{ }>
race(a: ObservableInput<A>): Observable<A>
a | Type: |
Observable<A>
race(a: ObservableInput<A>, b: ObservableInput<B>): Observable<A | B>
a | Type: |
b | Type: |
Observable<A | B>
race(a: ObservableInput<A>, b: ObservableInput<B>, c: ObservableInput<C>): Observable<A | B | C>
a | Type: |
b | Type: |
c | Type: |
Observable<A | B | C>
race(a: ObservableInput<A>, b: ObservableInput<B>, c: ObservableInput<C>, d: ObservableInput<D>): Observable<A | B | C | D>
a | Type: |
b | Type: |
c | Type: |
d | Type: |
Observable<A | B | C | D>
race(a: ObservableInput<A>, b: ObservableInput<B>, c: ObservableInput<C>, d: ObservableInput<D>, e: ObservableInput<E>): Observable<A | B | C | D | E>
a | Type: |
b | Type: |
c | Type: |
d | Type: |
e | Type: |
Observable<A | B | C | D | E>
race(observables: ObservableInput<T>[]): Observable<T>
observables | Type: |
Observable<T>
race(observables: ObservableInput<any>[]): Observable<{
}>
observables | Type: |
Observable<{ }>
race(...observables: ObservableInput<T>[]): Observable<T>
observables | Type: |
Observable<T>
race(...observables: ObservableInput<any>[]): Observable<{
}>
observables | Type: |
Observable<{ }>
© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/index/function/race