mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
allow manually updating subviews in templates w/ parentProvidesUpdates
This commit is contained in:
parent
357ce21678
commit
c85b2ca3c9
@ -131,6 +131,14 @@ export class TemplateView extends BaseUpdateView {
|
|||||||
this._subViews.splice(idx, 1);
|
this._subViews.splice(idx, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSubViews(value, props) {
|
||||||
|
if (this._subViews) {
|
||||||
|
for (const v of this._subViews) {
|
||||||
|
v.update(value, props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// what is passed to render
|
// what is passed to render
|
||||||
@ -260,10 +268,10 @@ class TemplateBuilder {
|
|||||||
|
|
||||||
// this insert a view, and is not a view factory for `if`, so returns the root element to insert in the template
|
// this insert a view, and is not a view factory for `if`, so returns the root element to insert in the template
|
||||||
// you should not call t.view() and not use the result (e.g. attach the result to the template DOM tree).
|
// you should not call t.view() and not use the result (e.g. attach the result to the template DOM tree).
|
||||||
view(view) {
|
view(view, mountOptions = undefined) {
|
||||||
let root;
|
let root;
|
||||||
try {
|
try {
|
||||||
root = view.mount();
|
root = view.mount(mountOptions);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return errorToDOM(err);
|
return errorToDOM(err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user