Files
owl/src/component/component.ts
T

31 lines
741 B
TypeScript
Raw Normal View History

2020-11-26 16:45:25 +01:00
import type { ComponentNode } from "./component_node";
2019-03-14 09:03:39 +01:00
2020-11-26 16:45:25 +01:00
// -----------------------------------------------------------------------------
// Component Class
// -----------------------------------------------------------------------------
2020-11-26 16:45:25 +01:00
export class Component {
static template: string = "";
2021-11-03 10:00:15 +01:00
static style: string = "";
2019-01-31 13:19:30 +01:00
2020-11-26 16:45:25 +01:00
props: any;
env: any;
__owl__: ComponentNode;
2020-11-26 16:45:25 +01:00
constructor(props: any, env: any, node: ComponentNode) {
this.props = props;
this.env = env;
this.__owl__ = node;
}
2020-11-26 16:45:25 +01:00
get el(): HTMLElement | Text | undefined {
const node = this.__owl__;
return node.bdom ? (node.bdom.firstNode() as any) : undefined;
2019-01-16 13:19:58 +01:00
}
2020-10-30 09:33:49 +01:00
setup() {}
2020-11-26 16:45:25 +01:00
render(): Promise<void> {
return this.__owl__.render();
2020-10-27 14:41:09 +01:00
}
}