mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] components: rename onRender->onWillRender, add onRendered
This commit is contained in:
committed by
Samuel Degueldre
parent
bdfe058279
commit
757dffefac
@@ -40,7 +40,7 @@ export function onDestroyed(fn: () => Promise<void> | void | any) {
|
||||
node.destroyed.push(fn);
|
||||
}
|
||||
|
||||
export function onRender(fn: () => void | any) {
|
||||
export function onWillRender(fn: () => void | any) {
|
||||
const node = getCurrent()!;
|
||||
const renderFn = node.renderFn;
|
||||
node.renderFn = () => {
|
||||
@@ -49,6 +49,16 @@ export function onRender(fn: () => void | any) {
|
||||
};
|
||||
}
|
||||
|
||||
export function onRendered(fn: () => void | any) {
|
||||
const node = getCurrent()!;
|
||||
const renderFn = node.renderFn;
|
||||
node.renderFn = () => {
|
||||
const result = renderFn();
|
||||
fn();
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
export function onError(fn: (error: Error) => void | any) {
|
||||
const node = getCurrent()!;
|
||||
let handlers = nodeErrorHandlers.get(node);
|
||||
|
||||
+2
-1
@@ -66,7 +66,8 @@ export {
|
||||
onWillUpdateProps,
|
||||
onWillPatch,
|
||||
onPatched,
|
||||
onRender,
|
||||
onWillRender,
|
||||
onRendered,
|
||||
onDestroyed,
|
||||
onError,
|
||||
} from "./component/lifecycle_hooks";
|
||||
|
||||
Reference in New Issue
Block a user