提交 35db91ec 编写于 作者: X xuzhihao

Fix issues of Notiofication docs

Signed-off-by: Nxuzhihao <xuzhihao16@huawei.com>
上级 e9f0bae3
......@@ -3,9 +3,17 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## support
## 导入模块
```js
import CommonEvent from '@ohos.commonEvent';
```
## Support
CommonEvent模块支持的事件类型。名称指的是系统公共事件宏;值指的是系统公共事件。
| 系统公共事件宏 | 系统公共事件名称 | 订阅者所需权限 | 说明 |
| 名称 | 值 | 订阅者所需权限 | 说明 |
| ------------ | ------------------ | ---------------------- | -------------------- |
| COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | 指示用户已完成引导并加载系统的公共事件的操作。 |
| COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | 表示用户已完成引导,系统已加载,但屏幕仍锁定的公共事件的操作。 |
......@@ -158,11 +166,6 @@
| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 | 表示设备飞行模式已更改的公共事件的动作。 |
| COMMON_EVENT_SPLIT_SCREEN | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | 表示分屏的公共事件的动作。 |
## 导入模块
```js
import CommonEvent from '@ohos.commonEvent';
```
## CommonEvent.publish
......@@ -172,6 +175,8 @@ publish(event: string, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Notification.CommonEvent
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
......@@ -205,6 +210,8 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\
**系统能力:** SystemCapability.Notification.CommonEvent
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 名称 | 读写属性 | 类型 | 必填 | 描述 |
......
......@@ -16,12 +16,14 @@ import emitter from '@ohos.events.emitter'
用于表示事件被投递的优先级。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 值 | 说明 |
| --------- | ---- | ------------------------------------------------- |
| IMMEDIATE | 0 | 表示事件被立即投递。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| HIGH | 1 | 表示事件先于LOW优先级投递。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| IMMEDIATE | 0 | 表示事件被立即投递。 |
| HIGH | 1 | 表示事件先于LOW优先级投递。 |
| LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。 |
| IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。 |
## emitter.on
......@@ -131,15 +133,19 @@ emitter.emit(innerEvent, eventData);
进程内的事件。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | ------------------------------- | ---- | ---- | ---------------------------------- |
| eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。 |
| priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。 |
## EventData
发送事件时传递的数据。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | ------------------ | ---- | ---- | -------------- |
| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。<br/>**系统能力**: SystemCapability.Notification.Emitter |
| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。 |
......@@ -50,6 +50,8 @@ publishReminder(reminderReq: ReminderRequest): Promise&lt;number&gt;
发布一个后台代理提醒,使用Promise方式实现异步调用。
**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER
**系统能力**: SystemCapability.Notification.ReminderAgent
**参数**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册