From 5ab947e7de4420a65193c185d6d78c7ae6c96bd5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 6 Oct 2020 18:05:02 +0200 Subject: [PATCH] pass urlRouter and navigation as view model options --- src/domain/ViewModel.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/domain/ViewModel.js b/src/domain/ViewModel.js index 7f973ad7..b1192424 100644 --- a/src/domain/ViewModel.js +++ b/src/domain/ViewModel.js @@ -22,15 +22,16 @@ import {EventEmitter} from "../utils/EventEmitter.js"; import {Disposables} from "../utils/Disposables.js"; export class ViewModel extends EventEmitter { - constructor({clock, emitChange} = {}) { + constructor(options = {}) { super(); this.disposables = null; this._isDisposed = false; - this._options = {clock, emitChange}; + this._options = options; } childOptions(explicitOptions) { - return Object.assign({}, this._options, explicitOptions); + const {navigation, urlRouter, clock} = this._options; + return Object.assign({navigation, urlRouter, clock}, explicitOptions); } track(disposable) { @@ -90,4 +91,12 @@ export class ViewModel extends EventEmitter { get clock() { return this._options.clock; } + + get urlRouter() { + return this._options.urlRouter; + } + + get navigation() { + return this._options.navigation; + } }