提交 0c2ffc13 编写于 作者: Z zengsiyu

fix: fix required permissions

Signed-off-by: Nzengsiyu <zengsiyu3@huawei.com>
Change-Id: Ie13945462c9abdc7473c1824b19953a386c1e9eb
Signed-off-by: Nzengsiyu <zengsiyu3@huawei.com>
上级 9083104e
......@@ -13,7 +13,7 @@ OpenHarmony通过CES(Common Event Service,公共事件服务)为应用程
## 公共事件订阅开发指导
### 场景介绍
当需要订阅某个公共事件,获取某个公共事件传递的参数时,可以创建一个订阅者对象,用于作为订阅公共事件的载体,订阅公共事件并获取公共事件传递而来的参数。订阅部分系统公共事件需要先申请权限,订阅这些事件所需要的权限请见[公共事件权限列表](../reference/apis/js-apis-commonEvent.md#Support)
当需要订阅某个公共事件,获取某个公共事件传递的参数时,可以创建一个订阅者对象,用于作为订阅公共事件的载体,订阅公共事件并获取公共事件传递而来的参数。订阅部分系统公共事件需要先申请权限,订阅这些事件所需要的权限请见[公共事件权限列表](../reference/apis/js-apis-commonEvent.md#权限列表)
### 接口说明
| 接口名 | 接口描述 |
......
......@@ -3,9 +3,7 @@
> **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## Support
权限列表。
## 权限列表
| 系统公共事件宏 | 系统公共事件名称 | 订阅者所需权限 |
| ------------ | ------------------ | ---------------------- |
......@@ -210,7 +208,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| -------- | -------- | ---------------------- | ---- | ---------------------- |
| event | 只读 | string | 是 | 表示要发布的公共事件。 |
| options | 只读 | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
| options | 只读 | [CommonEventPublishData](./js-apis-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | 只读 | AsyncCallback\<void> | 是 | 表示被指定的回调方法。 |
**示例:**
......@@ -290,7 +288,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca
| -------- | -------- | ---------------------- | ---- | ---------------------- |
| event | 只读 | string | 是 | 表示要发布的公共事件。 |
| userId | 只读 | number | 是 | 表示指定向该用户ID发送此公共事件。 |
| options | 只读 | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
| options | 只读 | [CommonEventPublishData](./js-apis-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | 只读 | AsyncCallback\<void> | 是 | 表示被指定的回调方法。 |
**示例:**
......@@ -333,8 +331,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------- | -------- | ------------------------------------------------------------ | ---- | -------------------------- |
| subscribeInfo | 只读 | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 |
| callback | 只读 | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 |
| subscribeInfo | 只读 | [CommonEventSubscribeInfo](./js-apis-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 |
| callback | 只读 | AsyncCallback\<[CommonEventSubscriber](./js-apis-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 |
**示例:**
......@@ -375,12 +373,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventS
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------- | -------- | ----------------------------------------------------- | ---- | -------------- |
| subscribeInfo | 只读 | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 |
| subscribeInfo | 只读 | [CommonEventSubscribeInfo](./js-apis-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 |
**返回值:**
| 类型 | 说明 |
| --------------------------------------------------------- | ---------------- |
| Promise\<[CommonEventSubscriber](#commoneventsubscriber)> | 返回订阅者对象。 |
| Promise\<[CommonEventSubscriber](./js-apis-commonEventSubscriber.md)> | 返回订阅者对象。 |
**示例:**
......@@ -415,8 +413,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEven
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ---------- | -------- | --------------------------------------------------- | ---- | -------------------------------- |
| subscriber | 只读 | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 |
| callback | 只读 | AsyncCallback\<[CommonEventData](#commoneventdata)> | 是 | 表示接收公共事件数据的回调函数。 |
| subscriber | 只读 | [CommonEventSubscriber](./js-apis-commonEventSubscriber.md) | 是 | 表示订阅者对象。 |
| callback | 只读 | AsyncCallback\<[CommonEventData](./js-apis-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 |
**示例:**
......@@ -453,7 +451,7 @@ function CreateSubscriberCallBack(err, commonEventSubscriber) {
CommonEvent.createSubscriber(subscribeInfo, CreateSubscriberCallBack);
```
## CommonEvent.unsubscribe
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册