refactoring: implement actionmanager, and router

So we now have a working SPA!
This commit is contained in:
Géry Debongnie
2019-01-24 10:58:46 +01:00
parent 443f5e210c
commit c6b83b1aed
10 changed files with 193 additions and 144 deletions
+14 -6
View File
@@ -1,28 +1,36 @@
import { QWeb } from "./core/qweb_vdom";
import { WEnv } from "./core/widget";
import { actions, Action } from "./services/actions";
import { ActionManager } from "./services/action_manager";
import Ajax from "./services/ajax";
import Router from "./services/router";
import { Ajax } from "./services/ajax";
import { Router } from "./services/router";
export interface Menu {
title: string;
actionID: number;
}
export interface Env extends WEnv {
actionManager: ActionManager;
actions: Action[];
ajax: Ajax;
router: Router;
menus: Menu[];
}
export function makeEnvironment(): Env {
const qweb = new QWeb();
const router = new Router();
const ajax = new Ajax();
const actionManager = new ActionManager();
const actionManager = new ActionManager(router);
const menus = [
{ title: "Discuss", actionID: 1 },
{ title: "CRM", actionID: 2 }
];
return {
qweb,
ajax,
router,
actionManager,
actions
menus
};
}