Hi guys,
I have code like this in Aurelia 2:
this._observerLocator.getArrayObserver(this.select1).subscribe({
handleCollectionChange: () => {
this._signaler.dispatchSignal("select1-changed");
}
});
If i want to temporarily unsubscribe and subscribe again (handling navigation back and forward in browser’s history, via "au:router:location-change"
), I have to put my ICollectionSubscriber
in a variable:
private _subscribe1 = {
handleCollectionChange: (...params) => {
this._signaler.dispatchSignal("select1-changed");
}
};
// elsewhere...
this._observerLocator.getArrayObserver(this.select1).unsubscribe(this._subscribe1);
Is there any reason why something like ISubscription
is not returned from .subscribe
method?