forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.ts
More file actions
34 lines (27 loc) · 956 Bytes
/
command.ts
File metadata and controls
34 lines (27 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '../type';
export interface IPublicApiCommand {
/**
* 注册一个新命令及其处理函数
*/
registerCommand(command: IPublicTypeCommand): void;
/**
* 注销一个已存在的命令
*/
unregisterCommand(name: string): void;
/**
* 通过名称和给定参数执行一个命令,会校验参数是否符合命令定义
*/
executeCommand(name: string, args?: IPublicTypeCommandHandlerArgs): void;
/**
* 批量执行命令,执行完所有命令后再进行一次重绘,历史记录中只会记录一次
*/
batchExecuteCommand(commands: { name: string; args?: IPublicTypeCommandHandlerArgs }[]): void;
/**
* 列出所有已注册的命令
*/
listCommands(): IPublicTypeListCommand[];
/**
* 注册错误处理回调函数
*/
onCommandError(callback: (name: string, error: Error) => void): void;
}