Last active
May 11, 2020 04:43
-
-
Save MattSPalmer/41e1aa065c576ffa8ba1a3ba722048c9 to your computer and use it in GitHub Desktop.
debug subscriptions
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
const onSubscribe = (fn) => stream => Rx.defer(() => { | |
fn(); | |
return stream; | |
}) | |
const logOnSubscribe = message => onSubscribe(() => console.log(message)); | |
Rx.interval(10e3).pipe( | |
switchMap(() => interval(200).pipe( | |
logOnSubscribe('subscribed to 200ms interval') | |
)) | |
).subscribe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment