I can use Rx.Observable.combineLatest so that I will notify the changes whenever any observable changes. But how can I know which observable changes?
var s1 = someObservable1();
var s2 = someObservable2();
Rx.Observable.combineLatest(s1, s2).subscribe(function(){
// How to know which Observable triggers combineLatest change
});
RxJs provides no means to accomplish this. Nevertheless you can do it with additional state:
var trigger = "";
Rx.Observable
.combineLatest(
s1.do(function() { trigger = "s1"; }),
s2.do(function() { trigger = "s2"; }))
.subscribe(function(){
// use trigger
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With