提交 9ded8056 编写于 作者: E ester.zhou

Update docs (17384)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 65a5edee
...@@ -36,12 +36,13 @@ Publishes a common event. This API uses an asynchronous callback to return the r ...@@ -36,12 +36,13 @@ Publishes a common event. This API uses an asynchronous callback to return the r
**Error codes** **Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md). For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
|ID |Error Message | | ID| Error Message |
|-----------|--------------------| | -------- | ----------------------------------- |
|1500004 |not System services or System app| | 401 | The parameter check failed. |
|1500007 |message send error| | 1500004 | not System services. |
|1500008 |CEMS error| | 1500007 | error sending message to Common Event Service. |
|1500009 |system error| | 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
**Example** **Example**
...@@ -80,17 +81,16 @@ Publishes a common event with given attributes. This API uses an asynchronous ca ...@@ -80,17 +81,16 @@ Publishes a common event with given attributes. This API uses an asynchronous ca
| callback | syncCallback\<void> | Yes | Callback used to return the result. | | callback | syncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message | | ID| Error Message |
|-----------|--------------------| | -------- | ----------------------------------- |
|1500004 |not System services or System app| | 401 | The parameter check failed. |
|1500007 |message send error| | 1500004 | not System services. |
|1500008 |CEMS error| | 1500007 | error sending message to Common Event Service. |
|1500009 |system error| | 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
**Example** **Example**
```ts ```ts
// Attributes of a common event. // Attributes of a common event.
var options = { var options = {
...@@ -137,12 +137,14 @@ Publishes a common event to a specific user. This API uses an asynchronous callb ...@@ -137,12 +137,14 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message | | ID| Error Message |
|-----------|--------------------| | -------- | ----------------------------------- |
|1500004 |not System services or System app| | 202 | not system app. |
|1500007 |message send error| | 401 | The parameter check failed. |
|1500008 |CEMS error| | 1500004 | not System services. |
|1500009 |system error| | 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
**Example** **Example**
...@@ -189,16 +191,17 @@ Publishes a common event with given attributes to a specific user. This API uses ...@@ -189,16 +191,17 @@ Publishes a common event with given attributes to a specific user. This API uses
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
|ID |Error Message | | ID| Error Message |
|-----------|--------------------| | -------- | ----------------------------------- |
|1500004 |not System services or System app| | 202 | not system app. |
|1500007 |message send error| | 401 | The parameter check failed. |
|1500008 |CEMS error| | 1500004 | not System services. |
|1500009 |system error| | 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
**Example** **Example**
```ts ```ts
// Attributes of a common event. // Attributes of a common event.
var options = { var options = {
...@@ -243,6 +246,14 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul ...@@ -243,6 +246,14 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul
| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. | | subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. |
| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 401 | The parameter check failed. |
**Example** **Example**
...@@ -293,6 +304,14 @@ Creates a subscriber. This API uses a promise to return the result. ...@@ -293,6 +304,14 @@ Creates a subscriber. This API uses a promise to return the result.
| --------------------------------------------------------- | ---------------- | | --------------------------------------------------------- | ---------------- |
| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Promise used to return the subscriber object.| | Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Promise used to return the subscriber object.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 401 | The parameter check failed. |
**Example** **Example**
```ts ```ts
...@@ -334,6 +353,17 @@ Subscribes to common events. This API uses an asynchronous callback to return th ...@@ -334,6 +353,17 @@ Subscribes to common events. This API uses an asynchronous callback to return th
| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | | subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. |
| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 401 | The parameter check failed. |
| 801 | capability not supported. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
**Example** **Example**
```ts ```ts
...@@ -395,6 +425,17 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur ...@@ -395,6 +425,17 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur
| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | | subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. |
| callback | AsyncCallback\<void> | No | Callback used to return the result.| | callback | AsyncCallback\<void> | No | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 401 | The parameter check failed. |
| 801 | capability not supported. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
**Example** **Example**
```ts ```ts
...@@ -465,6 +506,19 @@ Obtains the result code of this common event. This API uses an asynchronous call ...@@ -465,6 +506,19 @@ Obtains the result code of this common event. This API uses an asynchronous call
| -------- | ---------------------- | ---- | ------------------ | | -------- | ---------------------- | ---- | ------------------ |
| callback | AsyncCallback\<number> | Yes | Callback used to return the result.| | callback | AsyncCallback\<number> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 201 | The application dose not have permission to call the interface. |
| 202 | not system app. |
| 401 | The parameter check failed. |
| 1500004 | not system service. |
| 1500007 | The message send error. |
| 1500008 | The CEMS error. |
**Example** **Example**
```ts ```ts
...@@ -495,6 +549,19 @@ Obtains the result code of this common event. This API uses a promise to return ...@@ -495,6 +549,19 @@ Obtains the result code of this common event. This API uses a promise to return
| ---------------- | -------------------- | | ---------------- | -------------------- |
| Promise\<number> | Promise used to return the result.| | Promise\<number> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 201 | The application dose not have permission to call the interface. |
| 202 | not system app. |
| 401 | The parameter check failed. |
| 1500004 | not system service. |
| 1500007 | The message send error. |
| 1500008 | The CEMS error. |
**Example** **Example**
```ts ```ts
......
...@@ -40,6 +40,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -40,6 +40,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -92,6 +95,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -92,6 +95,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -142,6 +148,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -142,6 +148,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -187,6 +196,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -187,6 +196,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -234,6 +246,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -234,6 +246,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -279,6 +294,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -279,6 +294,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -325,7 +343,7 @@ Removes a notification for a specified application. This API uses a promise to r ...@@ -325,7 +343,7 @@ Removes a notification for a specified application. This API uses a promise to r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | --------------- | ---- | ---------- | | --------------- | --------------- | ---- | ---------- |
| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application.| | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application.|
| notificationKey | [NotificationKey](js-apis-notification.md#notificationkey)) | Yes | Notification key. | | notificationKey | [NotificationKey](js-apis-notification.md#notificationkey) | Yes | Notification key. |
| reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. | | reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. |
**Error codes** **Error codes**
...@@ -334,6 +352,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -334,6 +352,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -382,6 +403,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -382,6 +403,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -428,6 +452,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -428,6 +452,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -459,7 +486,7 @@ Removes all notifications for a specified application. This API uses an asynchro ...@@ -459,7 +486,7 @@ Removes all notifications for a specified application. This API uses an asynchro
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ---------------------------- | | -------- | --------------------- | ---- | ---------------------------- |
| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | Yes | Bundle information of the application. | | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes** **Error codes**
...@@ -468,6 +495,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -468,6 +495,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -513,6 +543,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -513,6 +543,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -547,7 +580,7 @@ Removes all notifications for a specified application. This API uses a promise t ...@@ -547,7 +580,7 @@ Removes all notifications for a specified application. This API uses a promise t
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | No | Bundle information of the application.| | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | No | Bundle information of the application.|
**Error codes** **Error codes**
...@@ -555,6 +588,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -555,6 +588,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -594,6 +630,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -594,6 +630,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -639,6 +678,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ ...@@ -639,6 +678,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 201 | Permission denied. |
| 202 | Not system application to call the interface. |
| 401 | The parameter check failed. |
| 1600001 | Internal error. | | 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. | | 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. | | 1600003 | Failed to connect service. |
...@@ -662,7 +704,7 @@ notificationSubscribe.removeAll(userId, removeAllCallback); ...@@ -662,7 +704,7 @@ notificationSubscribe.removeAll(userId, removeAllCallback);
## NotificationSubscriber ## NotificationSubscriber
Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribe). Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribesubscribe).
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
...@@ -670,7 +712,7 @@ Provides callbacks for receiving or removing notifications and serves as the inp ...@@ -670,7 +712,7 @@ Provides callbacks for receiving or removing notifications and serves as the inp
onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void
Callback for receiving notifications. Called when a notification is received.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -710,7 +752,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -710,7 +752,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void
Callback for canceling notifications. Called when a notification is canceled.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -750,7 +792,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -750,7 +792,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void
Callback for notification sorting updates. Called when the notification sorting list is updated.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -788,7 +830,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -788,7 +830,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
onConnect?:() => void onConnect?:() => void
Callback for subscription. Called when subscription is complete.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -820,7 +862,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -820,7 +862,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
onDisconnect?:() => void onDisconnect?:() => void
Callback for unsubscription. Called when unsubscription is complete.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -898,7 +940,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -898,7 +940,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notificationManager.md#donotdisturbdate)) => void onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notificationManager.md#donotdisturbdate)) => void
Callback for DND time setting updates. Called when the DND time setting is updated.
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -935,7 +977,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -935,7 +977,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
### onEnabledNotificationChanged ### onEnabledNotificationChanged
onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)) => void onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)) => void
Listens for the notification enabled status changes. This API uses an asynchronous callback to return the result. Listens for the notification enabled status changes. This API uses an asynchronous callback to return the result.
...@@ -947,7 +989,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono ...@@ -947,7 +989,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ------------ | ------------------------ | ---- | -------------------------- | | ------------ | ------------------------ | ---- | -------------------------- |
| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.| | callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)\> | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -973,47 +1015,6 @@ let subscriber = { ...@@ -973,47 +1015,6 @@ let subscriber = {
notificationSubscribe.subscribe(subscriber, subscribeCallback); notificationSubscribe.subscribe(subscriber, subscribeCallback);
``` ```
### onBadgeChanged<sup>10+</sup>
onBadgeChanged?:(data: [BadgeNumberCallbackData](#badgenumbercallbackdata)) => void
Listens for the change of the notification badge number.
**System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------- |
| callback | AsyncCallback\<[BadgeNumberCallbackData](#badgenumbercallbackdata)\> | Yes | Callback used to return the result.|
**Example**
```javascript
function subscribeCallback(err) {
if (err) {
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
};
function onBadgeChangedCallback(data) {
console.info("bundle: ", data.bundle);
console.info("uid: ", data.uid);
console.info("badgeNumber: ", data.badgeNumber);
};
let subscriber = {
onBadgeChanged: onBadgeChangedCallback
};
notificationSubscribe.subscribe(subscriber, subscribeCallback);
```
## RemoveReason ## RemoveReason
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -1024,15 +1025,3 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1024,15 +1025,3 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
| -------------------- | --- | -------------------- | | -------------------- | --- | -------------------- |
| CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. | | CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. |
| CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. | | CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. |
## BadgeNumberCallbackData<sup>10+</sup>
**System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description |
| ----------- | ------ | ---- | ---- | ------------ |
| bundle | string | Yes | No | Bundle name of the application.|
| uid | number | Yes | No | UID of the application. |
| badgeNumber | number | Yes | No | Notification badge number. |
...@@ -34,7 +34,7 @@ This error code is reported when a file path error occurs in invoking the **uplo ...@@ -34,7 +34,7 @@ This error code is reported when a file path error occurs in invoking the **uplo
**Possible Causes** **Possible Causes**
The file path is incorrect. The file path is incorrect or the file aready exists in the path.
**Solution** **Solution**
......
...@@ -219,54 +219,6 @@ struct MyComponent { ...@@ -219,54 +219,6 @@ struct MyComponent {
![flex1](figures/flex1.PNG) ![flex1](figures/flex1.PNG)
## Setting Width and Height for \<List> Components
When a **\<List>** component is nested within a **\<Scroll>** component, all of its content will be loaded if its width and height is not specified, which may result in performance drop.
```ts
@Entry
@Component
struct MyComponent {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
build() {
Scroll() {
List() {
ForEach(this.arr, (item) => {
ListItem() {
Text(`item value: ${item}`).fontSize(30).margin({ left: 10 })
}.height(100)
}, (item) => item.toString())
}
}.backgroundColor(Color.Pink)
}
}
```
Therefore, in the above scenario, you are advised to set the width and height for the **\<List>** component as follows:
```ts
@Entry
@Component
struct MyComponent {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
build() {
Scroll() {
List() {
ForEach(this.arr, (item) => {
ListItem() {
Text(`item value: ${item}`).fontSize(30).margin({ left: 10 })
}.height(100)
}, (item) => item.toString())
}.width('100%').height(500)
}.backgroundColor(Color.Pink)
}
}
```
![list1](figures/list1.gif)
## Minimizing White Blocks During Swiping ## Minimizing White Blocks During Swiping
To minimize white blocks during swiping, expand the UI loading range by increasing the value of **cachedCount** for the **\<List>** and **\<Grid>** components. **cachedCount** indicates the number of list or grid items preloaded outside of the screen. To minimize white blocks during swiping, expand the UI loading range by increasing the value of **cachedCount** for the **\<List>** and **\<Grid>** components. **cachedCount** indicates the number of list or grid items preloaded outside of the screen.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册