Skip to content

Instantly share code, notes, and snippets.

@LironHazan
Created October 11, 2020 08:46
Show Gist options
  • Save LironHazan/202889f329a4aca9543280a87efafc9c to your computer and use it in GitHub Desktop.
Save LironHazan/202889f329a4aca9543280a87efafc9c to your computer and use it in GitHub Desktop.
Ofir Fridman's example for blog post
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