Created
September 27, 2019 15:53
-
-
Save raloliver/2de84dffbca099e8af8f31a58207c254 to your computer and use it in GitHub Desktop.
RxJS: AsyncSubject, BehaviorSubject and ReplaySubject
This file contains 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
var subjectAsync = new Rx.AsyncSubject(); | |
var subscriptionAsync = subject.subscribe( | |
value => console.log(`My Value is ${value}`), | |
err => console.log(`Error message: ${err}`), | |
() => console.log('Completed!') | |
) | |
var counterAsync = 5, | |
interval = setInterval(()=>{ | |
subject.next(counter--); | |
if(!counter){ | |
clearInterval(interval); | |
subject.complete() | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment