Beta (still building)

race

race operator, you can pass multiple observables and return a reflection of the first observable emits value

Example: race operator


import { race, interval } from 'rxjs';
import { mapTo, take } from 'rxjs/operators';

const t1$ = interval(1000).pipe(mapTo('1'), take(5));
const t2$ = interval(3000).pipe(mapTo('2'), take(3));

const race$ = race(t1$, t2$);

Example 2: race operator


import { race, interval } from 'rxjs';
import { mapTo, take } from 'rxjs/operators';

const t1$ = interval(2000).pipe(mapTo('1'), take(5));
const t2$ = interval(1000).pipe(mapTo('2'), take(5));

const race$ = race(t1$, t2$);

Official Doc: rxjs.xxx