mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] app: improve API, small refactoring
This commit is contained in:
committed by
Aaron Bohy
parent
772c275bd4
commit
aad6b806ba
@@ -13,6 +13,16 @@ import { handleError, fibersInError } from "./error_handling";
|
||||
import { applyDefaultProps } from "./props_validation";
|
||||
import { STATUS } from "./status";
|
||||
|
||||
let currentNode: ComponentNode | null = null;
|
||||
|
||||
export function getCurrent(): ComponentNode | null {
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
export function useComponent(): Component {
|
||||
return currentNode!.component;
|
||||
}
|
||||
|
||||
export function component(
|
||||
name: string | typeof Component,
|
||||
props: any,
|
||||
@@ -62,12 +72,6 @@ export function component(
|
||||
// Component VNode
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
let currentNode: ComponentNode | null = null;
|
||||
|
||||
export function getCurrent(): ComponentNode | null {
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
type LifecycleHook = Function;
|
||||
|
||||
export class ComponentNode<T extends typeof Component = typeof Component>
|
||||
|
||||
Reference in New Issue
Block a user