hydrogen-web/src/domain/ViewModel.js
Bruno Windels 1f15ca6498 more WIP
2020-04-18 19:16:16 +02:00

24 lines
754 B
JavaScript

// 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
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();
}
}