[IMP] component/qweb: remove t-mounted directive

The t-mounted directive main goals can be achieved with hooks, in a
better and more intuitive way.

closes #308
This commit is contained in:
Géry Debongnie
2019-10-03 10:48:26 +02:00
parent 367725d194
commit 022b29b6a0
7 changed files with 5 additions and 161 deletions
+4 -6
View File
@@ -82,7 +82,7 @@ interface Internal<T extends Env, Props> {
boundHandlers: { [key: number]: any };
observer: Observer | null;
render: CompiledTemplate | null;
mountedHandlers: { [key: number]: Function };
mountedCB: Function | null;
willUnmountCB: Function | null;
willPatchCB: Function | null;
patchedCB: Function | null;
@@ -186,7 +186,7 @@ export class Component<T extends Env, Props extends {}> {
cmap: {},
currentFiber: null,
boundHandlers: {},
mountedHandlers: {},
mountedCB: null,
willUnmountCB: null,
willPatchCB: null,
patchedCB: null,
@@ -480,11 +480,10 @@ export class Component<T extends Env, Props extends {}> {
}
}
__owl__.isMounted = true;
const handlers = __owl__.mountedHandlers;
try {
this.mounted();
for (let key in handlers) {
handlers[key]();
if (__owl__.mountedCB) {
__owl__.mountedCB()
}
} catch (e) {
errorHandler(e, this);
@@ -601,7 +600,6 @@ export class Component<T extends Env, Props extends {}> {
vnode = __owl__.render!(this, {
promises,
handlers: __owl__.boundHandlers,
mountedHandlers: __owl__.mountedHandlers,
fiber: fiber
});
} catch (e) {