2019-01-16 13:19:58 +01:00
|
|
|
///<amd-module name="main" />
|
|
|
|
|
|
2019-02-18 15:34:23 +01:00
|
|
|
import { makeEnv } from "./env";
|
2019-02-19 20:47:21 +01:00
|
|
|
import { loadMenus, loadTemplates } from "./loaders";
|
|
|
|
|
import { actionRegistry } from "./registries";
|
2019-02-18 15:34:23 +01:00
|
|
|
import { rpc } from "./services/ajax";
|
2019-02-19 20:47:21 +01:00
|
|
|
import { Router } from "./services/router";
|
2019-02-27 13:48:36 +01:00
|
|
|
import { Store } from "./store/store";
|
2019-02-05 16:04:02 +01:00
|
|
|
import { Root } from "./widgets/root";
|
2019-01-17 18:08:39 +01:00
|
|
|
|
2019-01-27 09:41:56 +01:00
|
|
|
//------------------------------------------------------------------------------
|
2019-02-05 16:08:35 +01:00
|
|
|
// Web Client Bootstrapping
|
2019-01-27 09:41:56 +01:00
|
|
|
//------------------------------------------------------------------------------
|
2019-01-31 13:19:30 +01:00
|
|
|
|
2019-01-20 09:35:39 +01:00
|
|
|
document.addEventListener("DOMContentLoaded", async function() {
|
2019-02-18 15:34:23 +01:00
|
|
|
const services = {
|
2019-02-19 20:47:21 +01:00
|
|
|
rpc,
|
|
|
|
|
router: new Router()
|
2019-02-18 15:34:23 +01:00
|
|
|
};
|
2019-02-19 20:47:21 +01:00
|
|
|
|
|
|
|
|
const templates = await loadTemplates();
|
2019-02-18 15:34:23 +01:00
|
|
|
const menuInfo = loadMenus();
|
2019-02-19 20:47:21 +01:00
|
|
|
const store = new Store(services, menuInfo, actionRegistry);
|
|
|
|
|
const env = makeEnv(store, templates);
|
2019-02-03 14:14:09 +01:00
|
|
|
|
2019-02-05 16:08:35 +01:00
|
|
|
// Creating root widget
|
2019-02-19 20:47:21 +01:00
|
|
|
const rootWidget = new Root(env, store);
|
2019-01-21 23:08:03 +01:00
|
|
|
await rootWidget.mount(document.body);
|
2019-02-05 16:08:35 +01:00
|
|
|
|
|
|
|
|
// For debugging purpose, we keep a reference to the root widget in odoo
|
2019-02-03 14:14:09 +01:00
|
|
|
(<any>window).odoo.rootWidget = rootWidget;
|
2019-01-20 09:35:39 +01:00
|
|
|
});
|
2019-02-20 14:55:49 +01:00
|
|
|
|
|
|
|
|
let testMixin = Base =>
|
|
|
|
|
class extends Base {
|
|
|
|
|
calc() {
|
|
|
|
|
return 32;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Foo {}
|
|
|
|
|
|
|
|
|
|
class Bar extends testMixin(Foo) {}
|
|
|
|
|
|
|
|
|
|
console.log(new Bar().calc());
|