我可以使用Rx.Observable.combineLatest,以便每当有任何可观察的更改时我都会通知更改。但我怎么知道哪些可观察到的变化呢?
var s1 = someObservable1();
var s2 = someObservable2();
Rx.Observable.combineLatest(s1, s2).subscribe(function(){
// How to know which Observable triggers combineLatest change
});
答案 0 :(得分:5)
RxJs无法实现这一目标。不过,您可以使用其他状态:
var trigger = "";
Rx.Observable
.combineLatest(
s1.do(function() { trigger = "s1"; }),
s2.do(function() { trigger = "s2"; }))
.subscribe(function(){
// use trigger
});