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 {