Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(command): add command api docs #2909

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/api/canvas.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: canvas - 画布 API
sidebar_position: 12
sidebar_position: 10
---

> **@types** [IPublicApiCanvas](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)<br/>
Expand Down
101 changes: 101 additions & 0 deletions docs/docs/api/command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: command - 指令 API
sidebar_position: 10
---



## 模块概览

该模块使得与命令系统的交互成为可能,提供了一种全面的方式来处理、执行和管理应用程序中的命令。



## 接口

### IPublicApiCommand

与命令交互的接口。它提供了注册、注销、执行和管理命令的方法。



## 方法

### registerCommand

注册一个新命令及其处理函数。

```
typescriptCopy code
/**
* 注册一个新的命令及其处理程序。
* @param command {IPublicTypeCommand} - 要注册的命令。
*/
registerCommand(command: IPublicTypeCommand): void;
```

### unregisterCommand

注销一个已存在的命令。

```
typescriptCopy code
/**
* 注销一个已存在的命令。
* @param name {string} - 要注销的命令的名称。
*/
unregisterCommand(name: string): void;
```

### executeCommand

根据名称和提供的参数执行命令,确保参数符合命令的定义。

```
typescriptCopy code
/**
* 根据名称和提供的参数执行命令。
* @param name {string} - 要执行的命令的名称。
* @param args {IPublicTypeCommandHandlerArgs} - 命令的参数。
*/
executeCommand(name: string, args?: IPublicTypeCommandHandlerArgs): void;
```

### batchExecuteCommand

批量执行命令,在所有命令执行后进行重绘,历史记录中只记录一次。

```
typescriptCopy code
/**
* 批量执行命令,随后进行重绘,历史记录中只记录一次。
* @param commands {Array} - 命令对象的数组,包含名称和可选参数。
*/
batchExecuteCommand(commands: { name: string; args?: IPublicTypeCommandHandlerArgs }[]): void;
```

### listCommands

列出所有已注册的命令。

```
typescriptCopy code
/**
* 列出所有已注册的命令。
* @returns {IPublicTypeListCommand[]} - 已注册命令的数组。
*/
listCommands(): IPublicTypeListCommand[];
```

### onCommandError

为命令执行过程中的错误注册错误处理回调函数。

```
typescriptCopy code
/**
* 为命令执行过程中的错误注册一个回调函数。
* @param callback {(name: string, error: Error) => void} - 错误处理的回调函数。
*/
onCommandError(callback: (name: string, error: Error) => void): void;
```
2 changes: 1 addition & 1 deletion docs/docs/api/common.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: common - 通用 API
sidebar_position: 11
sidebar_position: 10
---

> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/commonUI.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: commonUI - UI 组件库
sidebar_position: 11
sidebar_position: 10
---

## 简介
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: config - 配置 API
sidebar_position: 8
sidebar_position: 5
---

> **@types** [IPublicModelEngineConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/configOptions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: config options - 配置列表
sidebar_position: 13
sidebar_position: 5
---

> **@types** [IPublicTypeEngineOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/event.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: event - 事件 API
sidebar_position: 7
sidebar_position: 10
---

> **@types** [IPublicApiEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/event.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/hotkey.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: hotkey - 快捷键 API
sidebar_position: 5
sidebar_position: 10
---

> **@types** [IPublicApiHotkey](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/hotkey.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/init.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: init - 初始化 API
sidebar_position: 10
sidebar_position: 0
---

> **@since** v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/logger.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: logger - 日志 API
sidebar_position: 9
sidebar_position: 10
---

> **@types** [IPublicApiLogger](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/logger.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/material.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: material - 物料 API
sidebar_position: 2
sidebar_position: 10
---

> **@types** [IPublicApiMaterial](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/material.ts)<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/model/_category_.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "模型定义 Models",
"position": 14,
"position": 100,
"collapsed": false,
"collapsible": true
}
2 changes: 1 addition & 1 deletion docs/docs/api/plugins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: plugins - 插件 API
sidebar_position: 4
sidebar_position: 2
---
> **@types** [IPublicApiPlugins](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/plugins.ts)<br/>
> **@since** v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/project.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: project - 模型 API
sidebar_position: 3
sidebar_position: 10
---
## 模块简介

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/setters.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: setters - 设置器 API
sidebar_position: 6
sidebar_position: 10
---
> **@types** [IPublicApiSetters](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/setters.ts)<br/>
> **@since** v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/simulatorHost.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: simulatorHost - 模拟器 API
sidebar_position: 3
sidebar_position: 10
---
> **@types** [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)<br/>
> **@since** v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/skeleton.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: skeleton - 面板 API
sidebar_position: 1
sidebar_position: 10
---
> **@types** [IPublicApiSkeleton](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/skeleton.ts)<br/>
> **@since** v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/workspace.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: workspace - 应用级 API
sidebar_position: 12
sidebar_position: 10
---

> **[@experimental](./#experimental)**<br/>
Expand Down
Loading