mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
update TemplateView with changes
This commit is contained in:
parent
0503b48c98
commit
eba92399e3
@ -2,7 +2,8 @@ import Template from "./Template.js";
|
|||||||
|
|
||||||
export default class TemplateView {
|
export default class TemplateView {
|
||||||
constructor(value) {
|
constructor(value) {
|
||||||
this._template = new Template(value, (t, value) => this.render(t, value));
|
this.viewModel = value;
|
||||||
|
this._template = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -10,9 +11,8 @@ export default class TemplateView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mount() {
|
mount() {
|
||||||
const root = this._template.root();
|
this._template = new Template(this.viewModel, (t, value) => this.render(t, value));
|
||||||
this._template.attach();
|
return this.root();
|
||||||
return root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
root() {
|
root() {
|
||||||
@ -20,7 +20,8 @@ export default class TemplateView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unmount() {
|
unmount() {
|
||||||
this._template.detach();
|
this._template.dispose();
|
||||||
|
this._template = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(value) {
|
update(value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user