mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
refactoring, work on environment
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { init } from "../../../libs/snabbdom/src/snabbdom";
|
||||
import sdListeners from "../../../libs/snabbdom/src/modules/eventlisteners";
|
||||
import sdAttrs from "../../../libs/snabbdom/src/modules/attributes";
|
||||
import sdListeners from "../../../libs/snabbdom/src/modules/eventlisteners";
|
||||
import { init } from "../../../libs/snabbdom/src/snabbdom";
|
||||
import { VNode } from "../../../libs/snabbdom/src/vnode";
|
||||
import QWeb from "./qweb_vdom";
|
||||
|
||||
const patch = init([sdListeners, sdAttrs]);
|
||||
|
||||
export interface WidgetEnv {
|
||||
export interface WEnv {
|
||||
qweb: QWeb;
|
||||
}
|
||||
|
||||
export default class Widget<T extends WidgetEnv> {
|
||||
export default class Widget<T extends WEnv> {
|
||||
name: string = "widget";
|
||||
template: string = "<div></div>";
|
||||
vnode: VNode | null = null;
|
||||
@@ -49,7 +49,7 @@ export default class Widget<T extends WidgetEnv> {
|
||||
|
||||
async mount(target?: HTMLElement): Promise<VNode> {
|
||||
await this.willStart();
|
||||
this.env!.qweb.addTemplate(this.name, this.template);
|
||||
this.env.qweb.addTemplate(this.name, this.template);
|
||||
delete this.template;
|
||||
const vnode = await this.render();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user