add IAjax and IActionManager interfaces

This commit is contained in:
Géry Debongnie
2019-01-26 20:22:32 +01:00
parent 5fe72757a7
commit fe7f506fcb
3 changed files with 36 additions and 8 deletions
+10 -2
View File
@@ -1,4 +1,4 @@
import { EventBus } from "../core/event_bus";
import { EventBus, Callback } from "../core/event_bus";
import { Widget } from "../core/widget";
import { Env } from "../env";
import { CRM } from "../widgets/crm";
@@ -19,6 +19,14 @@ interface ActWindowAction {
views: string[];
}
type ActionEvent = "action_ready";
export interface IActionManager {
doAction(actionID: number);
on(event: ActionEvent, owner: any, callback: Callback);
getCurrentAction(): ActionWidget | null;
}
export type Action = ClientAction | ActWindowAction;
export interface ActionWidget {
@@ -32,7 +40,7 @@ const actions: any[] = [
{ id: 2, title: "CRM", Widget: CRM }
];
export class ActionManager extends EventBus {
export class ActionManager extends EventBus implements IActionManager {
router: IRouter;
currentAction: ActionWidget | null = null;
+14 -1
View File
@@ -1 +1,14 @@
export class Ajax {}
export interface RPC {
model: string;
method: string;
args: any;
}
export interface IAjax {
rpc(rpc: RPC): Promise<any>;
}
export class Ajax implements IAjax {
rpc(rpc: RPC): Promise<any> {
return Promise.resolve(1);
}
}