未验证 提交 e7725b20 编写于 作者: O openharmony_ci 提交者: Gitee

!4401 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】wantagent.md描述优化

Merge pull request !4401 from gloria/N/A
......@@ -7,9 +7,9 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
### 接口说明
| 接口名 | 接口描述 |
| ---------------------------------------------------------------------------------------------- | ----------- |
| getWantAgentInfo(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>) | 以AsyncCallback形式创建WantAgent对象 |
| getWantAgent(info: WantAgentInfo): Promise\<WantAgent\> | 以Promise形式创建WantAgent对象 |
| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback\<CompleteData\>) | 触发WantAgent |
| getWantAgentInfo(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>) | 以异步回调形式创建WantAgent对象。 |
| getWantAgent(info: WantAgentInfo): Promise\<WantAgent\> | 以Promise形式创建WantAgent对象 |
| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback\<CompleteData\>) | 触发WantAgent |
### 开发步骤
1. 导入WantAgent模块。
......@@ -18,7 +18,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
import wantAgent from '@ohos.wantAgent';
```
2. 创建拉起Ability的WantAgentInfo信息详细的WantAgentInfo信息数据类型及包含的参数请见[WantAgentInfo文档](../reference/apis/js-apis-wantAgent.md#wantagentinfo)介绍。
2. 创建拉起Ability的WantAgentInfo信息详细的WantAgentInfo信息数据类型及包含的参数请见[WantAgentInfo文档](../reference/apis/js-apis-wantAgent.md#wantagentinfo)介绍。
```
private wantAgentObj = null //用于保存创建成功的wantAgent对象,后续使用其完成触发的动作。
......@@ -42,7 +42,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
}
```
3. 创建发布公共事件的WantAgentInfo信息
3. 创建发布公共事件的WantAgentInfo信息
```
private wantAgentObj = null //用于保存创建成功的WantAgent对象,后续使用其完成触发的动作。
......@@ -51,7 +51,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
var wantAgentInfo = {
wants: [
{
action: "event_name", // 设置事件名
action: "event_name", // 设置事件名
parameters: {}
}
],
......@@ -75,10 +75,10 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
})
```
5. 触发WantAgent
5. 触发WantAgent
```
//触发WantAgent
//触发WantAgent
var triggerInfo = {
code:0
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册