Created
April 18, 2018 16:45
-
-
Save magne4000/286adfbd3b57e58377637f4b7e53365a to your computer and use it in GitHub Desktop.
RxJs combineLatest
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
const oa = Rx.Observable.from(['a0', 'a1', 'a2']); | |
const ob = Rx.Observable.from(['b0', 'b1', 'b2', 'b3']); | |
const oc = Rx.Observable.from(['c0', 'c1', 'c2', 'c3']); | |
const r1 = oa | |
.zip(Rx.Observable.interval(300), function(a, b) { return a; }) | |
const r2 = ob | |
.zip(Rx.Observable.interval(440), function(a, b) { return a; }) | |
const r3 = oc | |
.zip(Rx.Observable.interval(420), function(a, b) { return a; }) | |
const listOfR = new Rx.Subject(); | |
const u1 = Rx.Observable.combineLatest([r1]).subscribe(listOfR) | |
u1.unsubscribe() | |
const u2 = Rx.Observable.combineLatest([r1, r2]).subscribe(listOfR) | |
u2.unsubscribe() | |
Rx.Observable.combineLatest([r1, r2, r3]).subscribe(listOfR) | |
listOfR.do(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://rxviz.com/v/7J2bbaJN