[IMP] app: mount app in "first-child" position

We reintroduce the possibility to mount the app in first position in
a target. The option "self" has been dropped since it is now possible
for a component to have several top level nodes.
This commit is contained in:
Mathieu Duckerts-Antoine
2021-10-22 17:30:20 +02:00
committed by Géry Debongnie
parent 06d207f60e
commit 7d7568d254
7 changed files with 92 additions and 76 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import { Component } from "./component/component";
import { ComponentNode } from "./component/component_node";
import { MountOptions } from "./component/fibers";
import { Scheduler } from "./component/scheduler";
import { TemplateSet } from "./qweb/template_helpers";
@@ -47,7 +48,7 @@ export class App<T extends typeof Component = any> extends TemplateSet {
}
}
mount(target: HTMLElement): Promise<InstanceType<T>> {
mount(target: HTMLElement, options?: MountOptions): Promise<InstanceType<T>> {
if (!(target instanceof HTMLElement)) {
throw new Error("Cannot mount component: the target is not a valid DOM element");
}
@@ -56,7 +57,7 @@ export class App<T extends typeof Component = any> extends TemplateSet {
}
const node = new ComponentNode(this.Root, this.props, this);
this.root = node;
return node.mountComponent(target);
return node.mountComponent(target, options);
}
destroy() {