rxjs APIs
- Observable
- Subject
- of
- BehaviorSubject
- Subscription
- throwError
- from
- combineLatest
- fromEvent
- merge
- timer
- interval
- ReplaySubject
- forkJoin
- EMPTY
- defer
- concat
- OperatorFunction
- iif
- Observer
- map
- NEVER
- zip
- firstValueFrom
- noop
- filter
- lastValueFrom
- catchError
- isObservable
- switchMap
- tap
- identity
- pipe
- empty
- asyncScheduler
- take
- ObservableInput
- startWith
- AsyncSubject
- asapScheduler
- MonoTypeOperatorFunction
- partition
- Subscriber
- Unsubscribable
- debounceTime
- delay
- range
- SubscriptionLike
- SchedulerLike
- retry
- toArray
- bindNodeCallback
- animationFrameScheduler
- distinctUntilChanged
- first
- takeUntil
- mergeMap
- skip
- withLatestFrom
- shareReplay
- mergeScan
- TimeoutError
- finalize
- concatMap
- using
- last
- race
- skipWhile
- scan
- ObservedValueOf
- share
- takeWhile
- repeat
- observeOn
- endWith
- pluck
- throttleTime
- scheduled
- timeout
- TeardownLogic
- bindCallback
Other Related APIs
rxjs#race TypeScript Examples
The following examples show how to use
rxjs#race.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: app.component.ts From blog2020 with MIT License | 6 votes |
startHeartbeat(): void {
this.stopHeartbeat();
this.networkError = false;
const heartbeat$ = timer(1_000, 30_000)
.pipe(
tap(() => this.connect().next('ping')),
concatMap(_ => {
return race(
of('timeout').pipe(delay(3_000)),
this.connect().pipe(filter(m => m === 'pong'), catchError(() => of('error')))
);
})
);
this.heartbeatSubscription = heartbeat$.subscribe(msg => {
if (msg === 'pong') {
this.networkError = false;
} else {
this.networkError = true;
this.webSocketSubject?.complete();
this.webSocketSubject = null;
}
});
}