mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
24 lines
754 B
JavaScript
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();
|
|
}
|
|
}
|