You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using OneWayBind to bind a view model collection to the view, and transform the view models to views in the selector function:
publicChart(){this.WhenActivated(d =>{d(this.OneWayBind(ViewModel, vm =>vm.XAxes, v =>v.ChartSurface.XAxes,ToAxesCollection));d(this.OneWayBind(ViewModel, vm =>vm.YAxes, v =>v.ChartSurface.YAxes,ToAxesCollection));});}privateAxisCollectionToAxesCollection(ReadOnlyObservableCollection<IAxisViewModel>axes){varaxesCollection=newAxisCollectionExtended();axes.ToObservableChangeSet().Transform(ToAxis).Adapt(newObservableCollectionAdaptor<IAxis>(axesCollection)).Subscribe();// TODO: dispose subscriptionreturnaxesCollection;}privateIAxisToAxis(IAxisViewModelvm){// [...]}
What is the best way of disposing the subscription object created in the selector (see TODO comment) when it is no longer required because the binding source updated or the binding was disposed?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am using
OneWayBind
to bind a view model collection to the view, and transform the view models to views in the selector function:What is the best way of disposing the subscription object created in the selector (see TODO comment) when it is no longer required because the binding source updated or the binding was disposed?
Thanks a lot for your help!
Beta Was this translation helpful? Give feedback.
All reactions