Created
October 11, 2020 08:46
-
-
Save LironHazan/202889f329a4aca9543280a87efafc9c to your computer and use it in GitHub Desktop.
Ofir Fridman's example for blog post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function pollingOnResolved(httpRequest$: Observable<any>, delayMs = 0): Observable<any> { | |
const polling$ = new BehaviorSubject({}); | |
const rePolling$ = | |
of('').pipe( | |
delay(delayMs), | |
tap(() => polling$.next({})), | |
skip(1) | |
); | |
const httpPolling$ = concat(httpRequest$, rePolling$); | |
return polling$.pipe(switchMap(() => httpPolling$)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment