vector-im-hydrogen-web/src/ui/web/TemplateView.js

31 lines
596 B
JavaScript
Raw Normal View History

import Template from "./Template.js";
export default class TemplateView {
constructor(value) {
2019-06-14 22:45:13 +02:00
this.viewModel = value;
this._template = null;
}
render() {
throw new Error("render not implemented");
}
mount() {
2019-06-14 22:45:13 +02:00
this._template = new Template(this.viewModel, (t, value) => this.render(t, value));
return this.root();
}
root() {
return this._template.root();
}
unmount() {
2019-06-14 22:45:13 +02:00
this._template.dispose();
this._template = null;
}
update(value) {
this._template.update(value);
}
}