[IMP] env: env is now frozen, useSubEnv does not affect user env

This commit is contained in:
Bruno Boi
2021-11-15 13:10:09 +01:00
committed by Géry Debongnie
parent 6aeff21d9a
commit d7403871fc
13 changed files with 164 additions and 73 deletions
+7 -4
View File
@@ -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;