Created
February 21, 2020 21:57
-
-
Save OliverJAsh/c02c9227b35627e833d3caf736a6b0be to your computer and use it in GitHub Desktop.
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 const delayUntil = <T>( | |
signal$: RxJS.Observable<unknown>, | |
): RxJS.OperatorFunction<T, T> => ob$ => | |
ob$.pipe( | |
RxJSOperators.publishReplay(undefined, undefined, publishedOb$ => | |
RxJS.concat( | |
signal$.pipe(RxJSOperators.first(), RxJSOperators.mergeMapTo(RxJS.EMPTY)), | |
publishedOb$, | |
), | |
), | |
); | |
/** | |
* Waits for a minimum time `ms` before emitting `ob$`. | |
*/ | |
export const waitMinimumOf = <T>(ms: number): RxJS.OperatorFunction<T, T> => ob$ => | |
ob$.pipe(delayUntil(RxJS.timer(ms))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment