mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
pass urlRouter and navigation as view model options
This commit is contained in:
parent
514095da7a
commit
5ab947e7de
@ -22,15 +22,16 @@ import {EventEmitter} from "../utils/EventEmitter.js";
|
|||||||
import {Disposables} from "../utils/Disposables.js";
|
import {Disposables} from "../utils/Disposables.js";
|
||||||
|
|
||||||
export class ViewModel extends EventEmitter {
|
export class ViewModel extends EventEmitter {
|
||||||
constructor({clock, emitChange} = {}) {
|
constructor(options = {}) {
|
||||||
super();
|
super();
|
||||||
this.disposables = null;
|
this.disposables = null;
|
||||||
this._isDisposed = false;
|
this._isDisposed = false;
|
||||||
this._options = {clock, emitChange};
|
this._options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
childOptions(explicitOptions) {
|
childOptions(explicitOptions) {
|
||||||
return Object.assign({}, this._options, explicitOptions);
|
const {navigation, urlRouter, clock} = this._options;
|
||||||
|
return Object.assign({navigation, urlRouter, clock}, explicitOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
track(disposable) {
|
track(disposable) {
|
||||||
@ -90,4 +91,12 @@ export class ViewModel extends EventEmitter {
|
|||||||
get clock() {
|
get clock() {
|
||||||
return this._options.clock;
|
return this._options.clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get urlRouter() {
|
||||||
|
return this._options.urlRouter;
|
||||||
|
}
|
||||||
|
|
||||||
|
get navigation() {
|
||||||
|
return this._options.navigation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user