mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
83532db48f
part of #430
31 lines
762 B
TypeScript
31 lines
762 B
TypeScript
import { QWeb } from "./qweb/index";
|
|
|
|
/**
|
|
* This file creates and exports the OWL 'config' object, with keys:
|
|
* - 'mode': 'prod' or 'dev',
|
|
* - 'env': the environment to use in root components.
|
|
*/
|
|
|
|
interface Config {
|
|
mode: string;
|
|
}
|
|
|
|
export const config = {} as Config;
|
|
|
|
Object.defineProperty(config, "mode", {
|
|
get() {
|
|
return QWeb.dev ? "dev" : "prod";
|
|
},
|
|
set(mode: string) {
|
|
QWeb.dev = mode === "dev";
|
|
if (QWeb.dev) {
|
|
const url = `https://github.com/odoo/owl/blob/master/doc/reference/config.md#mode`;
|
|
console.warn(
|
|
`Owl is running in 'dev' mode. This is not suitable for production use. See ${url} for more information.`
|
|
);
|
|
} else {
|
|
console.log(`Owl is now running in 'prod' mode.`);
|
|
}
|
|
}
|
|
});
|