2020-04-18 19:16:16 +02:00
|
|
|
// ViewModel should just be an eventemitter, not an ObservableValue
|
|
|
|
// as in some cases it would really be more convenient to have multiple events (like telling the timeline to scroll down)
|
|
|
|
// we do need to return a disposable from EventEmitter.on, or at least have a method here to easily track a subscription to an EventEmitter
|
|
|
|
|
2020-04-09 23:19:49 +02:00
|
|
|
export class ViewModel extends ObservableValue {
|
|
|
|
constructor(options) {
|
|
|
|
super();
|
|
|
|
this.disposables = new Disposables();
|
|
|
|
this._options = options;
|
|
|
|
}
|
|
|
|
|
|
|
|
childOptions(explicitOptions) {
|
|
|
|
return Object.assign({}, this._options, explicitOptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
track(disposable) {
|
|
|
|
this.disposables.track(disposable);
|
|
|
|
}
|
|
|
|
|
|
|
|
dispose() {
|
|
|
|
this.disposables.dispose();
|
|
|
|
}
|
|
|
|
}
|