From 717fd3b6abdc374180c619d97fe4ec0607b8882f Mon Sep 17 00:00:00 2001 From: Bruno Boi Date: Mon, 15 Nov 2021 14:49:34 +0100 Subject: [PATCH] [IMP] owl: mount util now takes an AppConfig --- src/app/app.ts | 4 ++-- src/index.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/app.ts b/src/app/app.ts index 0ec70068..f671d9c9 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -10,7 +10,7 @@ export interface Env { [key: string]: any; } -interface Config { +export interface AppConfig { dev?: boolean; env?: Env; translatableAttributes?: string[]; @@ -35,7 +35,7 @@ export class App extends TemplateSet { this.props = props; } - configure(config: Config): App { + configure(config: AppConfig): App { if (config.dev) { this.dev = config.dev; console.info(DEV_MSG); diff --git a/src/index.ts b/src/index.ts index 4d3a3a37..5a0ffa07 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,6 +31,7 @@ export const blockDom = { html, }; +import type { AppConfig } from "./app/app"; import { App } from "./app/app"; import { Component } from "./component/component"; import { getCurrent } from "./component/component_node"; @@ -39,10 +40,11 @@ export { App, Component }; export async function mount( C: T, - target: HTMLElement + target: HTMLElement, + config: AppConfig = {} ): Promise> { const app = new App(C); - return app.mount(target); + return app.configure(config).mount(target); } export function useComponent(): Component {