提交 44c19094 编写于 作者: E ester.zhou

update docs (8657)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 04fd66ce
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data. The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data.
> **NOTE**<br> > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -18,7 +18,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v ...@@ -18,7 +18,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Value | Subscriber Permissions | Description | | Name | Value | Subscriber Permission | Description |
| ------------ | ------------------ | ---------------------- | -------------------- | | ------------ | ------------------ | ---------------------- | -------------------- |
| COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded. | | COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded. |
| COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded but the screen is still locked. | | COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | Indicates the common event that the user has finished booting and the system has been loaded but the screen is still locked. |
...@@ -39,7 +39,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v ...@@ -39,7 +39,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_CLOSE_SYSTEM_DIALOGS | usual.event.CLOSE_SYSTEM_DIALOGS | - | Indicates the common event that a user closes a temporary system dialog box. | | COMMON_EVENT_CLOSE_SYSTEM_DIALOGS | usual.event.CLOSE_SYSTEM_DIALOGS | - | Indicates the common event that a user closes a temporary system dialog box. |
| COMMON_EVENT_PACKAGE_ADDED | usual.event.PACKAGE_ADDED | - | Indicates the common event that a new application package has been installed on the device. | | COMMON_EVENT_PACKAGE_ADDED | usual.event.PACKAGE_ADDED | - | Indicates the common event that a new application package has been installed on the device. |
| COMMON_EVENT_PACKAGE_REPLACED | usual.event.PACKAGE_REPLACED | - | Indicates the common event that a later version of an installed application package has replaced the previous one on the device. | | COMMON_EVENT_PACKAGE_REPLACED | usual.event.PACKAGE_REPLACED | - | Indicates the common event that a later version of an installed application package has replaced the previous one on the device. |
| COMMON_EVENT_MY_PACKAGE_REPLACED | usual.event.MY_PACKAGE_REPLACED | - | Indicates the common event that a later version of your application package has replaced the previous one. | | COMMON_EVENT_MY_PACKAGE_REPLACED | usual.event.MY_PACKAGE_REPLACED | - | Indicates the common event that a later version of your application package has replaced the previous one.
| COMMON_EVENT_PACKAGE_REMOVED | usual.event.PACKAGE_REMOVED | - | Indicates the common event that an installed application has been uninstalled from the device with the application data retained. | | COMMON_EVENT_PACKAGE_REMOVED | usual.event.PACKAGE_REMOVED | - | Indicates the common event that an installed application has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_BUNDLE_REMOVED | usual.event.BUNDLE_REMOVED | - | Indicates the common event that an installed bundle has been uninstalled from the device with the application data retained. | | COMMON_EVENT_BUNDLE_REMOVED | usual.event.BUNDLE_REMOVED | - | Indicates the common event that an installed bundle has been uninstalled from the device with the application data retained. |
| COMMON_EVENT_PACKAGE_FULLY_REMOVED | usual.event.PACKAGE_FULLY_REMOVED | - | Indicates the common event that an installed application, including both the application data and code, has been completely uninstalled from the device. | | COMMON_EVENT_PACKAGE_FULLY_REMOVED | usual.event.PACKAGE_FULLY_REMOVED | - | Indicates the common event that an installed application, including both the application data and code, has been completely uninstalled from the device. |
...@@ -173,7 +173,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v ...@@ -173,7 +173,7 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | - | Indicates the common event that the airplane mode of the device has changed. | | COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | - | Indicates the common event that the airplane mode of the device has changed. |
| COMMON_EVENT_SPLIT_SCREEN<sup>8+<sup> | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | Indicates the common event of screen splitting. | | COMMON_EVENT_SPLIT_SCREEN<sup>8+<sup> | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | Indicates the common event of screen splitting. |
| COMMON_EVENT_SLOT_CHANGE<sup>9+<sup> | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | Indicates the common event that the notification slot has changed. | | COMMON_EVENT_SLOT_CHANGE<sup>9+<sup> | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | Indicates the common event that the notification slot has changed. |
| COMMON_EVENT_SPN_INFO_CHANGED<sup>9+<sup> | usual.event.SPN_INFO_CHANGED | - | Indicates the common event that the SPN displayed has been updated. | | COMMON_EVENT_SPN_INFO_CHANGED <sup>9+<sup> | usual.event.SPN_INFO_CHANGED | - | Indicates the common event that the SPN displayed has been updated. |
## CommonEvent.publish ## CommonEvent.publish
...@@ -186,10 +186,10 @@ Publishes a common event. This API uses a callback to return the result. ...@@ -186,10 +186,10 @@ Publishes a common event. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------- | -------------------- | ---- | ---------------------- | | -------- | -------------------- | ---- | ---------------------- |
| event | Read only | string | Yes | Name of the common event to publish.| | event | string | Yes | Name of the common event to publish.|
| callback | Read only | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -219,11 +219,11 @@ Publishes a common event with given attributes. This API uses a callback to retu ...@@ -219,11 +219,11 @@ Publishes a common event with given attributes. This API uses a callback to retu
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------- | ---------------------- | ---- | ---------------------- | | -------- | ---------------------- | ---- | ---------------------- |
| event | Read only | string | Yes | Name of the common event to publish. | | event | string | Yes | Name of the common event to publish. |
| options | Read only | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| | options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.|
| callback | Read only | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | syncCallback\<void> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -263,11 +263,11 @@ Publishes a common event to a specific user. This API uses a callback to return ...@@ -263,11 +263,11 @@ Publishes a common event to a specific user. This API uses a callback to return
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------- | -------------------- | ---- | ---------------------------------- | | -------- | -------------------- | ---- | ---------------------------------- |
| event | Read only | string | Yes | Name of the common event to publish. | | event | string | Yes | Name of the common event to publish. |
| userId | Read only | number | Yes | User ID.| | userId | number | Yes | User ID.|
| callback | Read only | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -302,12 +302,12 @@ Publishes a common event with given attributes to a specific user. This API uses ...@@ -302,12 +302,12 @@ Publishes a common event with given attributes to a specific user. This API uses
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------- | ---------------------- | ---- | ---------------------- | | -------- | ---------------------- | ---- | ---------------------- |
| event | Read only | string | Yes | Name of the common event to publish. | | event | string | Yes | Name of the common event to publish. |
| userId | Read only| number | Yes| User ID.| | userId | number | Yes| User ID.|
| options | Read only | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| | options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.|
| callback | Read only | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -347,10 +347,10 @@ Creates a subscriber. This API uses a callback to return the result. ...@@ -347,10 +347,10 @@ Creates a subscriber. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | -------- | ------------------------------------------------------------ | ---- | -------------------------- | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- |
| subscribeInfo | Read only | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information. | | subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information. |
| callback | Read only | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -389,9 +389,9 @@ Creates a subscriber. This API uses a promise to return the result. ...@@ -389,9 +389,9 @@ Creates a subscriber. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | -------- | ----------------------------------------------------- | ---- | -------------- | | ------------- | ----------------------------------------------------- | ---- | -------------- |
| subscribeInfo | Read only | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information.| | subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information.|
**Return value** **Return value**
| Type | Description | | Type | Description |
...@@ -429,10 +429,10 @@ Subscribes to common events. This API uses a callback to return the result. ...@@ -429,10 +429,10 @@ Subscribes to common events. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | -------- | --------------------------------------------------- | ---- | -------------------------------- | | ---------- | ---------------------------------------------------- | ---- | -------------------------------- |
| subscriber | Read only | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | | subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. |
| callback | Read only | AsyncCallback\<[CommonEventData](#commoneventdata)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CommonEventData](#commoneventdata)> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -481,10 +481,10 @@ Unsubscribes from common events. This API uses a callback to return the result. ...@@ -481,10 +481,10 @@ Unsubscribes from common events. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | -------- | ----------------------------------------------- | ---- | ------------------------ | | ---------- | ----------------------------------------------- | ---- | ------------------------ |
| subscriber | Read only | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | | subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. |
| callback | Read only | AsyncCallback\<void> | No | Callback used to return the result.| | callback | AsyncCallback\<void> | No | Callback used to return the result.|
**Example** **Example**
...@@ -1234,37 +1234,37 @@ subscriber.finishCommonEvent().then(() => { ...@@ -1234,37 +1234,37 @@ subscriber.finishCommonEvent().then(() => {
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Readable| Writable| Type | Description |
| ---------- | -------- | -------------------- | ---- | ------------------------------------------------------- | | ---------- | ---- | ---- | -------------------- | ------------------------------------------------------- |
| event | Read only | string | Yes | Name of the common event that is being received. | | event | Yes | No | string | Name of the common event that is being received. |
| bundleName | Read only | string | No | Bundle name. | | bundleName | Yes | No | string | Bundle name. |
| code | Read only | number | No | Result code of the common event, which is used to transfer data of the int type. | | code | Yes | No | number | Result code of the common event, which is used to transfer data of the int type. |
| data | Read only | string | No | Custom result data of the common event, which is used to transfer data of the string type.| | data | Yes | No | string | Custom result data of the common event, which is used to transfer data of the string type.|
| parameters | Read only | {[key: string]: any} | No | Additional information about the common event. | | parameters | Yes | No | {[key: string]: any} | Additional information about the common event. |
## CommonEventPublishData ## CommonEventPublishData
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Readable| Writable| Type | Description |
| --------------------- | -------- | -------------------- | ---- | ---------------------------- | | --------------------- | ---- | ---- | -------------------- | ---------------------------- |
| bundleName | Read only | string | No | Bundle name. | | bundleName | Yes | No | string | Bundle name. |
| code | Read only | number | No | Result code of the common event. | | code | Yes | No | number | Result code of the common event. |
| data | Read only | string | No | Custom result data of the common event.| | data | Yes | No | string | Custom result data of the common event.|
| subscriberPermissions | Read only | Array\<string> | No | Permissions required for subscribers to receive the common event. | | subscriberPermissions | Yes | No | Array\<string> | Permissions required for subscribers to receive the common event. |
| isOrdered | Read only | boolean | No | Whether the common event is an ordered one. | | isOrdered | Yes | No | boolean | Whether the common event is an ordered one. |
| isSticky | Read only | boolean | No | Whether the common event is a sticky one. | | isSticky | Yes | No | boolean | Whether the common event is a sticky one. |
| parameters | Read only | {[key: string]: any} | No | Additional information about the common event. | | parameters | Yes | No | {[key: string]: any} | Additional information about the common event. |
## CommonEventSubscribeInfo ## CommonEventSubscribeInfo
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Readable| Writable| Type | Description |
| ------------------- | -------- | -------------- | ---- | ------------------------------------------------------------ | | ------------------- | ---- | ---- | -------------- | ------------------------------------------------------------ |
| events | Read only | Array\<string> | Yes | Name of the common event to publish. | | events | Yes | No | Array\<string> | Name of the common event to publish. |
| publisherPermission | Read only | string | No | Permissions required for publishers to publish the common event. | | publisherPermission | Yes | No | string | Permissions required for publishers to publish the common event. |
| publisherDeviceId | Read only | string | No | Device ID. The value must be the ID of an existing device on the same network. | | publisherDeviceId | Yes | No | string | Device ID. The value must be the ID of an existing device on the same network. |
| userId | Read only | number | No | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.| | userId | Yes | No | number | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.|
| priority | Read only | number | No | Subscriber priority. The value ranges from -100 to 1000. | | priority | Yes | No | number | Subscriber priority. The value ranges from -100 to 1000. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册