mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] env: env is now frozen, useSubEnv does not affect user env
This commit is contained in:
committed by
Géry Debongnie
parent
6aeff21d9a
commit
d7403871fc
+7
-4
@@ -6,9 +6,13 @@ import { TemplateSet } from "./template_set";
|
||||
|
||||
// reimplement dev mode stuff see last change in 0f7a8289a6fb8387c3c1af41c6664b2a8448758f
|
||||
|
||||
export interface Env {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
dev?: boolean;
|
||||
env?: { [key: string]: any };
|
||||
env?: Env;
|
||||
translatableAttributes?: string[];
|
||||
translateFn?: (s: string) => string;
|
||||
}
|
||||
@@ -21,7 +25,7 @@ See https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode for mor
|
||||
export class App<T extends typeof Component = any> extends TemplateSet {
|
||||
Root: T;
|
||||
props: any;
|
||||
env: any = {};
|
||||
env: Env = Object.freeze({});
|
||||
scheduler = new Scheduler(window.requestAnimationFrame.bind(window));
|
||||
root: ComponentNode | null = null;
|
||||
|
||||
@@ -36,9 +40,8 @@ export class App<T extends typeof Component = any> extends TemplateSet {
|
||||
this.dev = config.dev;
|
||||
console.info(DEV_MSG);
|
||||
}
|
||||
|
||||
if (config.env) {
|
||||
this.env = config.env;
|
||||
this.env = Object.freeze(Object.assign({}, config.env));
|
||||
}
|
||||
if (config.translateFn) {
|
||||
this.translateFn = config.translateFn;
|
||||
|
||||
Reference in New Issue
Block a user