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

30 lines
562 B
JavaScript
Raw Normal View History

import Template from "./Template.js";
export default class TemplateView {
constructor(value) {
this._template = new Template(value, (t, value) => this.render(t, value));
}
render() {
throw new Error("render not implemented");
}
mount() {
const root = this._template.root();
this._template.attach();
return root;
}
root() {
return this._template.root();
}
unmount() {
this._template.detach();
}
update(value) {
this._template.update(value);
}
}