I am looking to trigger .subscribe()
for my observable when any one of three object keys has been changed.
The method works if I manually duplicate it for each key:
this.myService.loadData(this.dataContainer.id, true)
.distinctUntilChanged((updatedData) => { return updatedData.relations; })
.subscribe(updatedData => {
console.log("relations changed",updatedData);
});
this.myService.loadData(this.dataContainer.id, true)
.distinctUntilChanged((updatedData) => { return updatedData.parent; })
.subscribe(updatedData => {
console.log("parent changed",updatedData);
});
this.myService.loadData(this.dataContainer.id, true)
.distinctUntilChanged((updatedData) => { return updatedData.children; })
.subscribe(updatedData => {
console.log("children changed",updatedData);
});
If I modify the distinctUntilChanged
comparer to return the entire updatedData
object, the subscribe function never triggers.
Is there a way to combine the three dinstinctUntilChanged
functions into one reducer?