diff --git a/src/domain/ViewModel.ts b/src/domain/ViewModel.ts index cfe22326..8b8581ae 100644 --- a/src/domain/ViewModel.ts +++ b/src/domain/ViewModel.ts @@ -58,6 +58,14 @@ export class ViewModel extends EventEmitter<{change return this._options[name]; } + observeNavigation(type: string, onChange: (value: string | true | undefined, type: string) => void) { + const segmentObservable = this.navigation.observe(type); + const unsubscribe = segmentObservable.subscribe((value: string | true | undefined) => { + onChange(value, type); + }) + this.track(unsubscribe); + } + track(disposable: D): D { if (!this.disposables) { this.disposables = new Disposables();