This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
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-15 02:15:13 +05:30
this.viewModel = value;
this._template = null;
}
render() {
throw new Error("render not implemented");
}
mount() {
2019-06-15 02:15:13 +05:30
this._template = new Template(this.viewModel, (t, value) => this.render(t, value));
return this.root();
}
root() {
return this._template.root();
}
unmount() {
2019-06-15 02:15:13 +05:30
this._template.dispose();
this._template = null;
}
update(value) {
this._template.update(value);
}
}