diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md index f76deb70e6a0b472ec8c7d10594cddb4cd1c3878..936a25c49fd8ec4ac1164f819635d855e0df852f 100644 --- a/en/application-dev/reference/apis/js-apis-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiappevent.md @@ -2,13 +2,13 @@ This module provides the application event logging functions, such as writing application events to the event file and managing the event logging configuration. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. ## Modules to Import -``` +```js import hiAppEvent from '@ohos.hiAppEvent'; ``` @@ -25,14 +25,14 @@ Writes event information to the event file of the current day. This API supports | Name | Type | Mandatory| Description | | --------- | ------------------------- | ---- | ------------------------------------------------------------ | -| eventName | string | Yes | Application event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter.| +| eventName | string | Yes | Application event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter. | | eventType | [EventType](#eventtype) | Yes | Application event type. | -| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated.| -| callback | AsyncCallback<void> | No | Callback used to process the received return value.
-  Value **0** indicates that the event verification is successful, and the event will be written to the event file asynchronously.
-  A value greater than **0** indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.
-  A value smaller than **0** indicates that the event verification fails, and the event will not be written to the event file.| +| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated. | +| callback | AsyncCallback<void> | No | Callback used to process the received return value.
-  Value **0** indicates that the event verification is successful, and the event will be written to the event file asynchronously.
-  A value greater than **0** indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.
-  A value smaller than **0** indicates that the event verification fails, and the event will not be written to the event file. | **Example** -``` +```js hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}, (err, value) => { if (err) { // Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails. @@ -58,19 +58,19 @@ Writes event information to the event file of the current day. This API supports | Name | Type | Mandatory| Description | | --------- | ----------------------- | ---- | ------------------------------------------------------------ | -| eventName | string | Yes | Application event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter.| +| eventName | string | Yes | Application event name.
You need to customize the event name. It can contain a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter. | | eventType | [EventType](#eventtype) | Yes | Application event type. | -| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated.| +| keyValues | object | Yes | Parameter key-value pair. For a variable-length parameter, enter each pair of parameter name and value in sequence. For a JSON parameter, enter the parameter name as the key and parameter value as the value.
- A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).
- The number of event parameters must be less than or equal to 32.
- The parameter name can contain a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a letter and cannot end with an underscore (\_).
- A string value can contain a maximum of 8*1024 characters.
- An array value can contain a maximum of 100 elements. Excess elements will be truncated. | **Return value** | Type | Description | | ------------------- | ------------------------------------------------------------ | -| Promise<void> | Promise used to process the callback in the then() and catch() methods when event writing succeeded or failed.| +| Promise<void> | Promise used to process the callback in the then() and catch() methods when event writing succeeded or failed. | **Example** -``` +```js hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}) .then((value) => { // Event writing succeeded. @@ -94,16 +94,16 @@ Configures the application event logging function, such as setting the event log | Name| Type | Mandatory| Description | | ------ | ----------------------------- | ---- | ------------------------ | -| config | [ConfigOption](#configoption) | Yes | Configuration items for application event logging.| +| config | [ConfigOption](#configoption) | Yes | Configuration items for application event logging. | **Return value** | Type | Description | | ------- | ----------------------------------------------------------- | -| boolean | Returns **true** if the configuration is successful; returns **false** otherwise.| +| boolean | Returns **true** if the configuration is successful; returns **false** otherwise. | **Example** -``` +```js // Set the application event logging switch. hiAppEvent.configure({ disable: true @@ -124,8 +124,8 @@ Provides the configuration items for application event logging. | Name | Type | Mandatory| Description | | ---------- | ------- | ---- | ------------------------------------------------------------ | -| disable | boolean | No | Application event logging switch. The value true means to disable the application event logging function, and the value false means the opposite.| -| maxStorage | string | No | Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space.| +| disable | boolean | No | Application event logging switch. The value true means to disable the application event logging function, and the value false means the opposite. | +| maxStorage | string | No | Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space. | ## EventType @@ -152,7 +152,7 @@ Provides constants that define the names of all predefined events. | ------------------------- | -------- | ---- | ---- | -------------------- | | USER_LOGIN | string | Yes | No | User login event. | | USER_LOGOUT | string | Yes | No | User logout event. | -| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event.| +| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event. | ## Param @@ -161,8 +161,8 @@ Provides constants that define the names of all predefined event parameters. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable | Writable | Description | | ------------------------------- | -------- | ---- | ---- | ------------------ | | USER_ID | string | Yes | No | Custom user ID. | -| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | -| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID.| +| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | +| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID. | \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-hitracechain.md b/en/application-dev/reference/apis/js-apis-hitracechain.md index 485eddc0fbfb59946228e859760885ad0ce1b633..cbaf898f75c37ba8921fe3d8ffd11e5484ec28e8 100644 --- a/en/application-dev/reference/apis/js-apis-hitracechain.md +++ b/en/application-dev/reference/apis/js-apis-hitracechain.md @@ -1,5 +1,7 @@ # Distributed Call Chain Tracing +This module implements call chain tracing throughout a service process. It provides functions such as starting and stopping call chain tracing and configuring trace points. + > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-hitracemeter.md b/en/application-dev/reference/apis/js-apis-hitracemeter.md index 656063edf90a71a74e8f7b5e90375acfccfdae9c..e856ee20a4c8956ff0f05707b596935b68ca9e7a 100644 --- a/en/application-dev/reference/apis/js-apis-hitracemeter.md +++ b/en/application-dev/reference/apis/js-apis-hitracemeter.md @@ -1,5 +1,7 @@ # Performance Tracing +This module provides the functions of tracing service processes and monitoring the system performance. It provides the data needed for hiTraceMeter to carry out performance analysis. + > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-update.md b/en/application-dev/reference/apis/js-apis-update.md index 251c1d59b610f4d01372186d0e40d0521cf62ca8..cba0c8a1ce4f475c5b60964ba37c8beee9454fc7 100644 --- a/en/application-dev/reference/apis/js-apis-update.md +++ b/en/application-dev/reference/apis/js-apis-update.md @@ -134,11 +134,11 @@ Obtains the new version information. This function uses an asynchronous callback **Example** ``` -updater.getNewVersionInfo(info => { +updater.getNewVersionInfo((err, info) => { console.log("getNewVersionInfo success " + info.status); - console.log(`info versionName = ` + info.checkResult[0].versionName); - console.log(`info versionCode = ` + info.checkResult[0].versionCode); - console.log(`info verifyInfo = ` + info.checkResult[0].verifyInfo); + console.log(`info versionName = ` + info.checkResults[0].versionName); + console.log(`info versionCode = ` + info.checkResults[0].versionCode); + console.log(`info verifyInfo = ` + info.checkResults[0].verifyInfo); }); ``` @@ -160,9 +160,9 @@ Obtains the new version information. This function uses a promise to return the ``` updater.getNewVersionInfo().then(value => { - console.log(`info versionName = ` + value.checkResult[0].versionName); - console.log(`info versionCode = ` + value.checkResult[0].versionCode); - console.log(`info verifyInfo = ` + value.checkResult[0].verifyInfo); + console.log(`info versionName = ` + value.checkResults[0].versionName); + console.log(`info versionCode = ` + value.checkResults[0].versionCode); + console.log(`info verifyInfo = ` + value.checkResults[0].verifyInfo); }).catch(err => { console.log("getNewVersionInfo promise error: " + err.code); }); @@ -185,11 +185,11 @@ Checks whether the current version is the latest. This function uses an asynchro **Example** ``` -updater.checkNewVersion(info => { +updater.checkNewVersion((err, info) => { console.log("checkNewVersion success " + info.status); - console.log(`info versionName = ` + info.checkResult[0].versionName); - console.log(`info versionCode = ` + info.checkResult[0].versionCode); - console.log(`info verifyInfo = ` + info.checkResult[0].verifyInfo); + console.log(`info versionName = ` + info.checkResults[0].versionName); + console.log(`info versionCode = ` + info.checkResults[0].versionCode); + console.log(`info verifyInfo = ` + info.checkResults[0].verifyInfo); }); ``` @@ -211,9 +211,9 @@ Checks whether the current version is the latest. This function uses a promise t ``` updater.checkNewVersion().then(value => { - console.log(`info versionName = ` + value.checkResult[0].versionName); - console.log(`info versionCode = ` + value.checkResult[0].versionCode); - console.log(`info verifyInfo = ` + value.checkResult[0].verifyInfo); + console.log(`info versionName = ` + value.checkResults[0].versionName); + console.log(`info versionCode = ` + value.checkResults[0].versionCode); + console.log(`info verifyInfo = ` + value.checkResults[0].verifyInfo); }).catch(err => { console.log("checkNewVersion promise error: " + err.code); }); @@ -284,7 +284,7 @@ Reboots the device and clears the user partition data. This function uses a prom **Example** ``` -updater.rebootAndCleanUserData(result => { +updater.rebootAndCleanUserData((err, result) => { console.log("rebootAndCleanUserData ", result) }); ``` @@ -330,7 +330,7 @@ Installs the update package. This function uses a promise to return the result. **Example** ``` -updater.applyNewVersion(result => { +updater.applyNewVersion((err, result) => { console.log("applyNewVersion ", result) }); ``` @@ -399,7 +399,7 @@ let policy = { autoUpgradeInterval: [ 2, 3 ], autoUpgradeCondition: 2 } -updater.setUpdatePolicy(policy, result => { +updater.setUpdatePolicy(policy, (err, result) => { console.log("setUpdatePolicy ", result) }); ``` @@ -458,7 +458,7 @@ Obtains the update policy. This function uses an asynchronous callback to return **Example** ``` -updater.getUpdatePolicy(policy => { +updater.getUpdatePolicy((err, policy) => { console.log("getUpdatePolicy success"); console.log(`policy autoDownload = ` + policy.autoDownload); console.log(`policy autoDownloadNet = ` + policy.autoDownloadNet);