[DOC] add hooks explanation, and testing/debug page

closes #372
closes #419
This commit is contained in:
Géry Debongnie
2019-11-22 09:40:51 +01:00
committed by aab-odoo
parent ff76747a05
commit 48744cfa87
7 changed files with 232 additions and 11 deletions
+2 -2
View File
@@ -139,10 +139,10 @@ export function useContextWithCB(ctx: Context, component: Component<any, any>, m
}
});
const __destroy = component.__destroy;
component.__destroy = (parent) => {
component.__destroy = parent => {
ctx.off("update", component);
delete mapping[id];
__destroy.call(component, parent);
}
};
return ctx.state;
}
+4 -2
View File
@@ -460,8 +460,10 @@ export class QWeb extends EventBus {
// this is a component, we modify in place the xml document to change
// <SomeComponent ... /> to <t t-component="SomeComponent" ... />
node.setAttribute("t-component", node.tagName);
} else if (node.tagName !== 't' && node.hasAttribute('t-component')) {
throw new Error(`Directive 't-component' can only be used on <t> nodes (used on a <${node.tagName}>)`);
} else if (node.tagName !== "t" && node.hasAttribute("t-component")) {
throw new Error(
`Directive 't-component' can only be used on <t> nodes (used on a <${node.tagName}>)`
);
}
const attributes = (<Element>node).attributes;