diff --git a/CODEOWNERS b/CODEOWNERS
index 9ffdaf23ba7351b7dd5e18b54559e424f4a2b80a..7c6530eb16de9051510d7344025cf8b61c566c78 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -231,7 +231,7 @@ zh-cn/application-dev/reference/apis/js-apis-audio.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-camera.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-image.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-media.md @zengyawen
-zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @qinxiaowang
+zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-i18n.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-intl.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @HelloCrease
@@ -365,4 +365,7 @@ zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
zh-cn/application-dev/reference/js-service-widget-ui @HelloCrease
zh-cn/application-dev/website.md @zengyawen
zh-cn/application-dev/faqs/ @zengyawen
-zh-cn/application-dev/reference/apis/js-apis-useriam-faceauth.md @zengyawen
\ No newline at end of file
+zh-cn/application-dev/reference/apis/js-apis-useriam-faceauth.md @zengyawen
+zh-cn/application-dev/reference/apis/js-apis-userfilemanager.md @zengyawen
+zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @zengyawen
+zh-cn/application-dev/reference/apis/Readme-CN.md @zengyawen
\ No newline at end of file
diff --git a/OAT.xml b/OAT.xml
index 8cc884632d4a963fa921c5905cfbf96e7e22edb7..4edf72f5a3b3e03801bdab83dad547cd7c0c18ef 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -66,7 +66,7 @@
-
+
diff --git a/en/application-dev/ability/stage-call.md b/en/application-dev/ability/stage-call.md
index cad2aeddec2ae0782776009d4a8a9b092bace023..390e1b6c3ce5393956d0a7801f362ab7f49578a4 100644
--- a/en/application-dev/ability/stage-call.md
+++ b/en/application-dev/ability/stage-call.md
@@ -81,7 +81,7 @@ import Ability from '@ohos.application.Ability'
```ts
export default class MySequenceable {
num: number = 0
- str: String = ""
+ str: string = ""
constructor(num, string) {
this.num = num
diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
index 01fe1ed68b3eb05341438da3d81270afdc4a92e3..f18f59468d0650400adfb50b87645c763a740b9c 100644
--- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
+++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
@@ -22,15 +22,16 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(): Promise<number>; | Queries the priority group of this application. This API uses a promise to return the result.|
| function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. |
-| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.|
+| function getRecentlyUsedModules(callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **1000**.|
+| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries the number of notifications from all applications based on the specified start time and end time.|
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.|
-| function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.|
+| function queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(bundleName? : string): Promise<number>; | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result.|
| function setBundleGroup(bundleName : string, newGroup: GroupType, callback: AsyncCallback>boolean>): void | Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function setBundleGroup(bundleName : string, newGroup : GroupType): Promise>boolean>; | Sets the group for the application specified by **bundleName**. This API uses a promise to return the result.|
-| function registerGroupCallBack(callback: Callback>BundleActiveGroupCallbackInfo>, callback: AsyncCallback>boolean>): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
-| function registerGroupCallBack(callback: Callback>BundleActiveGroupCallbackInfo>): Promise>boolean>; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
+| function registerGroupCallBack(groupCallback: Callback>BundleActiveGroupCallbackInfo>, callback: AsyncCallback>boolean>): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
+| function registerGroupCallBack(groupCallback: Callback>BundleActiveGroupCallbackInfo>): Promise>boolean>; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
| function unRegisterGroupCallBack(callback: AsyncCallback>boolean>): void | Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result.|
| function unRegisterGroupCallBack(): Promise>boolean>; | Deregisters the callback for application group changes. This API uses a promise to return the result.|
diff --git a/en/application-dev/device/sensor-guidelines.md b/en/application-dev/device/sensor-guidelines.md
index 99c6cc6c045a6f7d9a813372af163ab1eaa2efe1..50ebd3428f89eba4f968dd98e5fe2edee91bee34 100644
--- a/en/application-dev/device/sensor-guidelines.md
+++ b/en/application-dev/device/sensor-guidelines.md
@@ -26,70 +26,30 @@
| -------- | -------- | -------- |
| ohos.sensor | sensor.on(sensorType, callback:AsyncCallback<Response>): void | Subscribes to data changes of a type of sensor.|
| ohos.sensor | sensor.once(sensorType, callback:AsyncCallback<Response>): void | Subscribes to only one data change of a type of sensor.|
-| ohos.sensor | sensor.off(sensorType, callback:AsyncCallback<void>): void | Unsubscribes from sensor data changes.|
+| ohos.sensor | sensor.off(sensorType, callback?:AsyncCallback<void>): void | Unsubscribes from sensor data changes.|
## How to Develop
-1. To obtain data from a type of sensor, configure the requested permissions in the **config.json** file.
-
- ```
- "reqPermissions": [
- {
- "name": "ohos.permission.ACCELEROMETER",
- "reason": "",
- "usedScene": {
- "ability": [
- "sensor.index.MainAbility",
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.GYROSCOPE",
- "reason": "",
- "usedScene": {
- "ability": [
- "sensor.index.MainAbility",
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.ACTIVITY_MOTION",
- "reason": "ACTIVITY_MOTION_TEST",
- "usedScene": {
- "ability": [
- "sensor.index.MainAbility",
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.READ_HEALTH_DATA",
- "reason": "HEALTH_DATA_TEST",
- "usedScene": {
- "ability": [
- "sensor.index.MainAbility",
- ".MainAbility"
- ],
- "when": "inuse"
- }
- }
- ]
- ```
+1. Before obtaining data from a type of sensor, check whether the required permission has been configured.
+ The system provides the following sensor-related permissions:
+ - ohos.permission.ACCELEROMETER
+
+ - ohos.permission.GYROSCOPE
+
+ - ohos.permission.ACTIVITY_MOTION
+
+ - ohos.permission.READ_HEALTH_DATA
+
+ For details about how to configure a permission, see [Declaring Permissions](../security/accesstoken-guidelines.md).
2. Subscribe to data changes of a type of sensor.
```
- import sensor from "@ohos.sensor"
- sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){
- console.info("Subscription succeeded. data = " + data); // The call is successful, and the obtained sensor data is printed.
- }
- );
+ import sensor from "@ohos.sensor";
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(data){
+ console.info("Data obtained successfully. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained.
+ });
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
@@ -99,11 +59,8 @@
3. Unsubscribe from sensor data changes.
```
- import sensor from "@ohos.sensor"
- sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() {
- console.info("Succeeded in unsubscribing from acceleration sensor data."); // The unsubscription is successful, and the result is printed.
- }
- );
+ import sensor from "@ohos.sensor";
+ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER);
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
@@ -113,11 +70,10 @@
4. Subscribe to only one data change of a type of sensor.
```
- import sensor from "@ohos.sensor"
- sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) {
- console.info("Data obtained successfully. data=" + data); // The call is successful, and the obtained sensor data is printed.
- }
- );
+ import sensor from "@ohos.sensor";
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(data) {
+ console.info("Data obtained successfully. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained.
+ });
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
@@ -127,11 +83,12 @@
If the API fails to be called, you are advised to use the **try/catch** statement to capture error information that may occur in the code. Example:
```
+ import sensor from "@ohos.sensor";
try {
- sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) {
- console.info("Data obtained successfully. data=" + data); // The call is successful, and the obtained sensor data is printed.
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(data) {
+ console.info("Data obtained successfully. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained.
});
} catch (error) {
- console.error(error);
+ console.error("Failed to get sensor data");
}
- ```
+ ```
\ No newline at end of file
diff --git a/en/application-dev/device/sensor-overview.md b/en/application-dev/device/sensor-overview.md
index ec2374fbdf0fe63d1e10cbf26beff696c899025b..cb6129928d3796779075bcfc28da7f606bd130d9 100644
--- a/en/application-dev/device/sensor-overview.md
+++ b/en/application-dev/device/sensor-overview.md
@@ -52,15 +52,12 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso
1. To obtain data of the following sensors, you must claim the required permissions.
- Table 7 Sensor data permissions
-
-| Sensor | Permission | Sensitivity | Permission Description |
-| ------------------------- | -------------------------------- | ------------ | ----------------------- |
-| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows an application to subscribe to data of these acceleration-related sensors in the motion category.|
-| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.|
-| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. |
-| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. |
-
-
-
+ | Sensor | Permission | Sensitivity | Permission Description |
+ | ------------------------- | -------------------------------- | ------------ | ----------------------- |
+ | Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows an application to subscribe to data of these acceleration-related sensors in the motion category.|
+ | Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.|
+ | Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. |
+ | Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. |
+
2. The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting.
+
diff --git a/en/application-dev/device/usb-guidelines.md b/en/application-dev/device/usb-guidelines.md
index ae40bcddfd756caf88d1bc506bfba4b9a8d01a6d..d51625ccb9605fe2fb35b95f71eebc4e1607b753 100644
--- a/en/application-dev/device/usb-guidelines.md
+++ b/en/application-dev/device/usb-guidelines.md
@@ -1,13 +1,13 @@
# USB Service Development
-The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
-
## When to Use
In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
## APIs
+The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
+
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md).
**Table 1** Open USB APIs
@@ -16,12 +16,12 @@ The following table lists the USB APIs currently available. For details, see the
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| hasRight(deviceName: string): boolean | Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise. |
| requestRight(deviceName: string): Promise\ | Requests the temporary permission for a given application to access the USB device. |
-| connectDevice(device: USBDevice): Readonly\ | Connects to the USB device based on the device information returned by **getDevices()**. |
+| connectDevice(device: USBDevice): Readonly\ | Connects to the USB device based on the device information returned by `getDevices()`. |
| getDevices(): Array> | Obtains the USB device list. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
-| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface |
-| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise\ | Performs bulk transfer. |
+| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface. |
+| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise\ | Performs bulk transfer. |
| closePipe(pipe: USBDevicePipe): number | Closes a USB device pipe. |
| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. |
| getFileDescriptor(pipe: USBDevicePipe): number | Obtains the file descriptor. |
@@ -30,7 +30,7 @@ The following table lists the USB APIs currently available. For details, see the
## How to Develop
-You can set a USB device as a host to connect to a device for data transfer. The development procedure is as follows:
+You can set a USB device as the USB host to connect to other USB devices for data transfer. The development procedure is as follows:
1. Obtain the USB device list.
@@ -113,7 +113,7 @@ You can set a USB device as a host to connect to a device for data transfer. The
Claim the corresponding interface from deviceList.
interface1 must be one present in the device configuration.
*/
- usb.claimInterface(pipe , interface1, true);
+ usb.claimInterface(pipe, interface1, true);
```
4. Perform data transfer.
diff --git a/en/application-dev/device/vibrator-guidelines.md b/en/application-dev/device/vibrator-guidelines.md
index 97f9f5933b55c9a1b57b5555db5812b6576a262a..0dfc8344e5bb27a7ab6b6cd11943595c9f7855a6 100644
--- a/en/application-dev/device/vibrator-guidelines.md
+++ b/en/application-dev/device/vibrator-guidelines.md
@@ -22,42 +22,7 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md
## How to Develop
-1. Declare the permissions required for controlling vibrators on the hardware device in the `config.json` file.
-
- ```
- "reqPermissions": [
- {
- "name": "ohos.permission.ACCELEROMETER",
- "reason": "",
- "usedScene": {
- "ability": [
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.VIBRATE",
- "reason": "",
- "usedScene": {
- "ability": [
- ".MainAbility"
- ],
- "when": "inuse"
- }
- },
- {
- "name": "ohos.permission.ACTIVITY_MOTION",
- "reason": "",
- "usedScene": {
- "ability": [
- ".MainAbility"
- ],
- "when": "inuse"
- }
- }
- ]
- ```
+1. Before using the vibrator on a device, you must declare the **ohos.permission.VIBRATE** permission. For details about how to configure a permission, see [Declaring Permissions](../security/accesstoken-guidelines.md).
2. Trigger the device to vibrate.
diff --git a/en/application-dev/device/vibrator-overview.md b/en/application-dev/device/vibrator-overview.md
index 62e0d0d7b99e8bc4eaf5c38b4fc3006a19264df2..aea46d62cab1225c26e138decde615924593bcb6 100644
--- a/en/application-dev/device/vibrator-overview.md
+++ b/en/application-dev/device/vibrator-overview.md
@@ -23,4 +23,4 @@ The vibrator is a Misc device that consists of four modules: Vibrator API, Vibra
## Constraints
-When using a vibrator, you must declare the **ohos.permission.VIBRATE** permission before you can control the vibration effect. The authorization mode of this permission is **system_grant**.
+When using a vibrator, you must declare the **ohos.permission.VIBRATE** permission before you can control the vibration effect.
diff --git a/en/application-dev/faqs/Readme-EN.md b/en/application-dev/faqs/Readme-EN.md
index b87a565b6da485ea85add166accd20f25cbb686c..dc45ed9db0eec504b1ff6f535babf11265f2df91 100644
--- a/en/application-dev/faqs/Readme-EN.md
+++ b/en/application-dev/faqs/Readme-EN.md
@@ -1,6 +1,11 @@
# FAQs
- [Ability Framework Development](faqs-ability.md)
+- [Data Management Development](faqs-data-management.md)
+- [File Management Development](faqs-file-management.md)
+- [Graphics and Image Development](faqs-graphics.md)
+- [hdc_std Command Usage](faqs-ide.md)
+- [IDE Usage](faqs-hdc-std.md)
- [ArkUI (JavaScript) Development](faqs-ui-js.md)
- [ArkUI (eTS) Development](faqs-ui-ets.md)
- [Graphics and Image Development](faqs-graphics.md)
@@ -8,6 +13,7 @@
- [Data Management Development](faqs-data-management.md)
- [Device Management Development](faqs-device-management.md)
- [Native API Usage](faqs-native.md)
+- [Network and Connection Development](faqs-connectivity.md)
- [Usage of Third- and Fourth-Party Libraries](faqs-third-party-library.md)
- [Development Board](faqs-development-board.md)
diff --git a/en/application-dev/faqs/faqs-connectivity.md b/en/application-dev/faqs/faqs-connectivity.md
new file mode 100644
index 0000000000000000000000000000000000000000..3b8dea82129c03f0dc12c12296a28b9a0c46c99b
--- /dev/null
+++ b/en/application-dev/faqs/faqs-connectivity.md
@@ -0,0 +1,33 @@
+# Network and Connection Development
+
+
+
+## What are the data formats supported by extraData in an HTTP request?
+
+Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
+
+**extraData** indicates additional data in an HTTP request. It varies depending on the HTTP request method.
+
+- If the HTTP request uses a POST or PUT method, **extraData** serves as the content of the HTTP request.
+
+- If the HTTP request uses a GET, OPTIONS, DELETE, TRACE, or CONNECT method, **extraData** serves as a supplement to the HTTP request parameters and will be added to the URL when the request is sent.
+
+- If you pass in a string object, **extraData** contains the string encoded on your own.
+
+
+## What does error code 28 mean for an HTTP request?
+
+Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
+
+Error code 28 refers to **CURLE_OPERATION_TIMEDOUT**, which means a libcurl library operation timeout. For details, see any HTTP status code description available.
+
+Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
+
+
+## What does error code 6 mean for the response of \@ohos.net.http.d.ts?
+
+Applicable to: OpenHarmony SDK 3.2.3.5
+
+Error code 6 indicates a failure to resolve the host in the address. You can ping the URL carried in the request to check whether the host is accessible.
+
+Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
diff --git a/en/application-dev/faqs/faqs-hdc-std.md b/en/application-dev/faqs/faqs-hdc-std.md
new file mode 100644
index 0000000000000000000000000000000000000000..04c0a202a57b702164b8bcb7a32299d3abd5d75c
--- /dev/null
+++ b/en/application-dev/faqs/faqs-hdc-std.md
@@ -0,0 +1,69 @@
+# hdc_std Command Usage
+
+
+
+## What are the commands commonly used for log management?
+
+Applicable to: OpenHarmony SDK 3.2.2.5
+
+- Clearing logs: hdc_std shell hilog -r
+
+- Increasing the buffer size to 20 MB: hdc_std shell hilog -G 20M
+
+- Capturing logs: hdc_std shell hilog > log.txt
+
+
+## What should I do to avoid log flow control?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+- Disabling log flow control: hdc_std shell hilog -Q pidoff
+
+- Disabling the privacy flag: hdc_std shell hilog -p off
+
+- Increasing the log buffer to 200 MB: hdc_std shell hilog -G 200M
+
+- Enabling the log function of the specific domain (that is, disabling the global log function): hdc_std shell hilog –b D –D 0xd0xxxxx
+
+After performing the preceding operations, restart the DevEco Studio.
+
+
+## Is HiLog or Console recommended for log printing? How do I set the domain if HiLog is used?
+
+Applicable to: OpenHarmony SDK 3.2.2.5
+
+[HiLog](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md) is recommended for an application to print logs. For details about domain setting, see [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md#hilogisloggable).
+
+
+## What is the maximum length of a log record when HiLog is used? Is it configurable?
+
+Applicable to: OpenHarmony SDK 3.2.2.5
+
+The maximum length of a log record is 1,024 characters, and it is not changeable.
+
+
+## What should I do if a HAP package cannot be opened after being installed on the development board using the IDE?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+Check whether the SDK version is consistent with the system version on the development board. You are advised to use the SDK version and system version that are released on the same day.
+
+
+## How do I upload files using an hdc command?
+
+Applicable to: OpenHarmony SDK 3.2.2.5
+
+Run the **hdc_std file send** command.
+
+## How do I prevent the screen of the RK3568 development board from turning off?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+Run the **hdc_std shell "power-shell setmode 602"** command.
+
+
+## How do I start an ability using an hdc command?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+Run the **hdc_std shell aa start -a AbilityName -b bundleName -m moduleName** command.
diff --git a/en/application-dev/faqs/faqs-ide.md b/en/application-dev/faqs/faqs-ide.md
new file mode 100644
index 0000000000000000000000000000000000000000..b4a089c873e1eac856c287e639556dc7facbea50
--- /dev/null
+++ b/en/application-dev/faqs/faqs-ide.md
@@ -0,0 +1,20 @@
+# IDE Usage
+
+
+## What should do if the error message "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN" is displayed?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+1. Run **npm config set strict-ssl=false** on the DevEco Studio terminal.
+
+2. Run the **npm install** on the DevEco Studio terminal.
+
+## After manual updating of the DevEco Studio SDK, the error message "Cannot find module 'xxx\ets\x.x.x.x\build-tools\ets-loader\node_modules\webpack\bin\webpack.js'" is displayed during HAP building. What should I do?
+
+Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
+
+1. Run **npm install** in the **ets\x.x.x.x\build-tools\ets-loader** directory of the SDK.
+
+2. Run **npm install** in the **js\x.x.x.x\build-tools\ace-loader** directory of the SDK.
+
+3. Perform HAP building again.
diff --git a/en/application-dev/faqs/faqs-ui-ets.md b/en/application-dev/faqs/faqs-ui-ets.md
index 61fe069fcf25e8e5ae2a5ff4078a3952ad468447..fd21421cd95edc2bc838b8401724fae10448d9fd 100644
--- a/en/application-dev/faqs/faqs-ui-ets.md
+++ b/en/application-dev/faqs/faqs-ui-ets.md
@@ -14,7 +14,7 @@ Below are the restrictions on using generator functions in TypeScript:
- The generator function cannot contain local variables.
-None of the above restrictions apply to anonymous function implementations of event handlers (such as **onClick**)
+None of the above restrictions apply to anonymous function implementations of event handlers (such as **onClick**).
Negative example:
diff --git a/en/application-dev/media/audio-stream-manager.md b/en/application-dev/media/audio-stream-manager.md
index 9a8176b4bdab20b681ad9b3e96343a2ccfc10829..eb89957e9b8793b149c368445f1232bf0ff3b563 100644
--- a/en/application-dev/media/audio-stream-manager.md
+++ b/en/application-dev/media/audio-stream-manager.md
@@ -117,7 +117,7 @@ This API can be used to obtain the unique ID of the audio stream, UID of the aud
console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address);
console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]);
console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]);
- console.info('ChannnelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks);
+ console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks);
}
}
}
diff --git a/en/application-dev/media/remote-camera.md b/en/application-dev/media/remote-camera.md
index 8d9bd0eb7b7568e9cb46dd6c2a37b4380933b0bf..e35950e73b1993b8a446f75e3007a80e4bbaff19 100644
--- a/en/application-dev/media/remote-camera.md
+++ b/en/application-dev/media/remote-camera.md
@@ -5,7 +5,7 @@
You can call the APIs provided by the **Camera** module to develop a distributed camera that provides the basic camera functions such as shooting and video recording.
## How to Develop
-Connect your calculator to a distributed device. Your calculator will call **getCameras()** to obtain the camera list and traverse the returned camera list to check **ConnctionType** of the **Camera** objects. If **ConnctionType** of a **Camera** object is **CAMERA_CONNECTION_REMOTE**, your calculator will use this object to create a **CameraInput** object. The subsequent call process is the same as that of the local camera development. For details about the local camera development, see [Camera Development](./camera.md).
+Connect your calculator to a distributed device. Your calculator will call **getCameras()** to obtain the camera list and traverse the returned camera list to check **ConnectionType** of the **Camera** objects. If **ConnectionType** of a **Camera** object is **CAMERA_CONNECTION_REMOTE**, your calculator will use this object to create a **CameraInput** object. The subsequent call process is the same as that of the local camera development. For details about the local camera development, see [Camera Development](./camera.md).
For details about the APIs, see [Camera Management](../reference/apis/js-apis-camera.md).
diff --git a/en/application-dev/quick-start/package-structure.md b/en/application-dev/quick-start/package-structure.md
index cae1337dea083ff731be54f0536fa33f6fd64812..076bc9474ba724746938c1a4da837a3679c73d5a 100644
--- a/en/application-dev/quick-start/package-structure.md
+++ b/en/application-dev/quick-start/package-structure.md
@@ -232,7 +232,6 @@ Table 11 Internal structure of the module tag
| distroFilter | Application distribution rules. AppGallery uses these rules to distribute HAP files to the matching devices. Distribution rules cover three factors: API version, screen shape, and screen resolution. AppGallery distributes a HAP file to the device whose on the mapping between **deviceType** and these three factors. For details, see Table 29. | Object | Yes (initial value: left empty) Set this attribute when an application has multiple entry modules. |
| reqCapabilities | Device capabilities required for running the application. | String array| Yes (initial value: left empty) |
| commonEvents | Static broadcast. For details, see Table 35. | Object array | Yes (initial value: left empty) |
-| allowClassMap | Metadata of the HAP file. The value can be **true** or **false**. If the value is **true**, the HAP file uses the Java object proxy mechanism provided by the OpenHarmony framework. | Boolean | No (initial value: **false**) |
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String | Yes (initial value: left empty) |
Example of the **module** tag structure:
@@ -348,7 +347,7 @@ Table 17 Internal structure of the abilities attribute
| Attribute | Description | Data Type | Initial Value Allowed |
| ---------------- | ------------------------------------------------------------ | ---------- | -------------------------------------------------------- |
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. Devices running OpenHarmony do not support this attribute.| String | Yes (initial value: left empty) |
-| name | Name of the ability. The value is a reverse domain name, in the format of "*Bundle name*.*Class name*", for example, **"com.example.myapplication.MainAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".MainAbility"**. The ability name must be unique in an application. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. Note: When you use DevEco Studio to create a project, the configuration of the first ability is generated by default, including the **MainAbility.java** file and the class name **MainAbility** defaulted in the **name** string for the **abilities** attribute in **config.json**. The value of this attribute can be customized if you use other IDE tools. The value can contain a maximum of 127 characters.| String | No |
+| name | Name of the ability. The value is a reverse domain name, in the format of "*Bundle name*.*Class name*", for example, **"com.example.myapplication.MainAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".MainAbility"**. The ability name must be unique in an application. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types. Note: If you use DevEco Studio to create the project, an ability named **MainAbility** will be created together with the default configuration in the **config.json** file. The value of this attribute can be customized if you use other IDE tools. The value can contain a maximum of 127 characters.| String | No |
| description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String | Yes (initial value: left empty) |
| icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon. Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String | Yes (initial value: left empty) |
| label | Ability name visible to users. The value can be a name string or a resource index to names in multiple languages. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label. Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String | Yes (initial value: left empty) |
@@ -372,7 +371,7 @@ Table 17 Internal structure of the abilities attribute
| supportPipMode | Whether the ability allows the user to enter the Picture in Picture (PiP) mode. The PiP mode enables the user to watch a video in a small window that hovers on top of a full screen window (main window). This attribute applies only to the ability using the Page template. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean | Yes (initial value: **false**) |
| formsEnabled | Whether the ability can provide forms. This attribute applies only to the ability using the Page template. **true**: This ability can provide forms. **false**: This ability cannot provide forms.| Boolean | Yes (initial value: **false**) |
| forms | Details about the forms used by the ability. This attribute is valid only when **formsEnabled** is set to **true**. For details, see Table 27.| Object array | Yes (initial value: left empty) |
-| srcLanguage | Programming language used to develop the ability. | String | The value can be **java**, **js**, or **ets**. |
+| srcLanguage | Programming language used to develop the ability. | String | The value can be **js**, or **ets**. |
| srcPath | Path of the JS code and components corresponding to the ability. | String | Yes (initial value: left empty) |
| uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider. Devices running OpenHarmony do not support this attribute. For details, see Table 18.| Object | Yes (initial value: left empty) |
| startWindowIcon | Index to the icon file of the ability startup page. Example value: **$media:icon**. | String | Yes (initial value: left empty) |
@@ -587,12 +586,10 @@ Table 27 Internal structure of the forms attribute
| name | Class name of the widget. The value is a string with a maximum of 127 bytes. | String | No |
| description | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes.| String | Yes (initial value: left empty) |
| isDefault | Whether the widget is a default one. Each ability has only one default widget. **true**: The widget is the default one. **false**: The widget is not the default one.| Boolean | No |
-| type | Type of the widget. Available values are as follows: **Java**: indicates a Java-programmed widget. **JS**: indicates a JavaScript-programmed widget.| String | No |
+| type | Type of the widget. Available values are as follows: **JS**: indicates a JavaScript-programmed widget.| String | No |
| colorMode | Color mode of the widget. Available values are as follows: **auto**: The widget adopts the auto-adaptive color mode. **dark**: The widget adopts the dark color mode. **light**: The widget adopts the light color mode.| String | Yes (initial value: **auto**)|
| supportDimensions | Grid styles supported by the widget. Available values are as follows: 1 * 2: indicates a grid with one row and two columns. 2 * 2: indicates a grid with two rows and two columns. 2 * 4: indicates a grid with two rows and four columns. 4 * 4: indicates a grid with four rows and four columns.| String array| No |
| defaultDimension | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget.| String | No |
-| landscapeLayouts | Landscape layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No |
-| portraitLayouts | Portrait layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No |
| updateEnabled | Whether the widget can be updated periodically. Available values are as follows: **true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended. **false**: The widget cannot be updated periodically.| Boolean | No |
| scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. | String | Yes (initial value: **0:0**) |
| updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes. If the value is **0**, this field does not take effect. If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number | Yes (initial value: **0**) |
@@ -632,9 +629,9 @@ Example of the **forms** attribute structure:
]
},
{
- "name": "Form_Java",
- "description": "It's Java Form",
- "type": "Java",
+ "name": "Form_JS",
+ "description": "It's JS Form",
+ "type": "JS",
"colorMode": "auto",
"isDefault": false,
"updateEnabled": true,
diff --git a/en/application-dev/quick-start/start-with-ets-fa.md b/en/application-dev/quick-start/start-with-ets-fa.md
index 325f4983f16f0cd48899fb657d3c9e41d2f9c3d8..03ed574bb99bcd65cecf0c6ca4710ab2271db9d3 100644
--- a/en/application-dev/quick-start/start-with-ets-fa.md
+++ b/en/application-dev/quick-start/start-with-ets-fa.md
@@ -187,7 +187,7 @@
## Implementing Page Redirection
-You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
+You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
diff --git a/en/application-dev/quick-start/start-with-ets-stage.md b/en/application-dev/quick-start/start-with-ets-stage.md
index 7c623151a90c6f7fe278ee9354ff3232456b6026..b6b8cd11b8ba18b59931c1bf0244d4af3d7ec888 100644
--- a/en/application-dev/quick-start/start-with-ets-stage.md
+++ b/en/application-dev/quick-start/start-with-ets-stage.md
@@ -185,7 +185,7 @@
## Implementing Page Redirection
-You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
+You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
diff --git a/en/application-dev/quick-start/start-with-js-fa.md b/en/application-dev/quick-start/start-with-js-fa.md
index dbd2931eba6f6de6c6d23777a5c761dc505dc7c4..03b037aeb529dcf7d481caf56db32625943c055b 100644
--- a/en/application-dev/quick-start/start-with-js-fa.md
+++ b/en/application-dev/quick-start/start-with-js-fa.md
@@ -181,7 +181,7 @@
## Implementing Page Redirection
-You can implement page redirection through the [page router](../ui/ui-js-building-ui-routes.md), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
+You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index fe77dc5347f70c5cbcef596dbd8c3b57df83d9cc..e580b6bbef7bd71869de1da19a3a3d5c4757370d 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -146,6 +146,7 @@
- [@ohos.privacyManager](js-apis-privacyManager.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
+ - [@ohos.userIAM.faceAuth](js-apis-useriam-faceauth.md)
- [@system.cipher](js-apis-system-cipher.md)
- Data Management
diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md
index 9aab0179f06478fef211871d29e90daa33cf5609..9d33d34e9e0275c538e1cf2913af5fc0fdc656bc 100644
--- a/en/application-dev/reference/apis/js-apis-ability-context.md
+++ b/en/application-dev/reference/apis/js-apis-ability-context.md
@@ -6,8 +6,8 @@ This module provides APIs for accessing ability-specific resources. You can use
> **NOTE**
>
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-> The APIs of this module can be used only in the stage model.
+> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> - The APIs of this module can be used only in the stage model.
## Usage
diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
index 619ed387b6338fa06a064b3848a3491ee7ea08c9..4b1a66f071f464d6662d8429606c48aa025e8ef6 100644
--- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
+++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
@@ -4,12 +4,12 @@ The **wantConstant** module provides the actions, entities, and flags used in **
> **NOTE**
>
-> The initial APIs of this module are supported since API 6. 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 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
-```
-import wantConstant from '@ohos.ability.wantConstant'
+```js
+import wantConstant from '@ohos.ability.wantConstant';
```
## wantConstant.Action
@@ -46,8 +46,13 @@ Enumerates the action constants of the **Want** object.
| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. |
| PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. |
| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. |
-| ACTION_MARKER_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market. **System API**: This is a system API and cannot be called by third-party applications. |
-
+| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market. **System API**: This is a system API and cannot be called by third-party applications. |
+| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | Action of crowdtesting an application from the application market. **System API**: This is a system API and cannot be called by third-party applications. |
+| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | Action of obtaining the sandbox flag. **System API**: This is a system API and cannot be called by third-party applications. |
+| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |Action of obtaining the DLP bundle name. **System API**: This is a system API and cannot be called by third-party applications. |
+| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |Action of obtaining the DLP module name. **System API**: This is a system API and cannot be called by third-party applications. |
+| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |Action of obtaining the DLP ability name. **System API**: This is a system API and cannot be called by third-party applications. |
+| DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |Action of obtaining the DLP index. **System API**: This is a system API and cannot be called by third-party applications. |
## wantConstant.Entity
diff --git a/en/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md
index c48d33d59a701fb998f82316d5c70a0d86fc5ea1..1fa16906d34877c7e7dce4638b472b0c539b8921 100644
--- a/en/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md
@@ -78,7 +78,7 @@ export default class MyWindowExtensionAbility extends WindowExtensionAbility {
## WindowExtensionAbility.onWindowReady
-onWindowReady(window: Window): void
+onWindowReady(window: window.Window): void
Called when a window is ready.
@@ -88,7 +88,7 @@ Called when a window is ready.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| window | [Window](js-apis-window.md) | Yes| Current **Window** instance.|
+| window | [window.Window](js-apis-window.md#window) | Yes| Current **Window** instance.|
**Example**
@@ -99,7 +99,7 @@ export default class MyWindowExtensionAbility extends WindowExtensionAbility {
onWindowReady(window) {
window.loadContent('WindowExtAbility/pages/index1').then(() => {
window.getProperties().then((pro) => {
- console.log("WindowExtension " + JSON.stringify(pro));
+ console.log('WindowExtension ' + JSON.stringify(pro));
})
window.show();
})
diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md
index 565210637c6e83f83ec734c0905e11596baaf0db..87a9809bb9b49db443ec6f7d1617a2228dacaf88 100644
--- a/en/application-dev/reference/apis/js-apis-application-ability.md
+++ b/en/application-dev/reference/apis/js-apis-application-ability.md
@@ -4,7 +4,7 @@ The **Ability** module manages the ability lifecycle and context, such as creati
This module provides the following common ability-related functions:
-- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee).
+- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability).
- [Callee](#callee): implements callbacks for registration and deregistration of caller notifications.
> **NOTE**
@@ -22,12 +22,12 @@ import Ability from '@ohos.application.Ability';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
-| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
-| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
-| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
+| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
+| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
+| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
+| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
## Ability.onCreate
@@ -39,13 +39,13 @@ Called to initialize the service logic when an ability is created.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
-| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
+ | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
+**Example**
+
```js
class myAbility extends Ability {
onCreate(want, param) {
@@ -65,12 +65,12 @@ Called when a **WindowStage** is created for this ability.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| windowStage | window.WindowStage | Yes| **WindowStage** information.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | windowStage | window.WindowStage | Yes| **WindowStage** information.|
+**Example**
+
```js
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
@@ -88,8 +88,8 @@ Called when the **WindowStage** is destroyed for this ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onWindowStageDestroy() {
@@ -109,12 +109,12 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| windowStage | window.WindowStage | Yes| **WindowStage** information.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | windowStage | window.WindowStage | Yes| **WindowStage** information.|
+**Example**
+
```js
class myAbility extends Ability {
onWindowStageRestore(windowStage) {
@@ -132,8 +132,8 @@ Called when this ability is destroyed to clear resources.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onDestroy() {
@@ -151,8 +151,8 @@ Called when this ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onForeground() {
@@ -170,8 +170,8 @@ Called when this ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onBackground() {
@@ -191,18 +191,18 @@ Called to save data during the ability migration preparation process.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| wantParam | {[key: string]: any} | Yes| **want** parameter.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | wantParam | {[key: string]: any} | Yes| **want** parameter.|
**Return value**
-| Type| Description|
-| -------- | -------- |
-| AbilityConstant.OnContinueResult | Continuation result.|
-
-**Example**
+ | Type| Description|
+ | -------- | -------- |
+ | AbilityConstant.OnContinueResult | Continuation result.|
+**Example**
+
```js
import AbilityConstant from "@ohos.application.AbilityConstant"
class myAbility extends Ability {
@@ -225,20 +225,17 @@ Called when the ability startup mode is set to singleton.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
-| launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
+ | launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.|
+**Example**
+
```js
class myAbility extends Ability {
- onNewWant(want, launchParams) {
+ onNewWant(want) {
console.log('onNewWant, want:' + want.abilityName);
- if (launchParams.launchReason === AbilityConstant.LaunchReason.CONTINUATION) {
- console.log('onNewWant, launchReason is continuation');
- }
}
}
```
@@ -254,12 +251,12 @@ Called when the configuration of the environment where the ability is running is
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
+**Example**
+
```js
class myAbility extends Ability {
onConfigurationUpdated(config) {
@@ -278,12 +275,12 @@ Dumps client information.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| params | Array\ | Yes| Parameters in the form of a command.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | params | Array\ | Yes| Parameters in the form of a command.|
+**Example**
+
```js
class myAbility extends Ability {
dump(params) {
@@ -293,11 +290,35 @@ Dumps client information.
}
```
+## Ability.onMemoryLevel
+
+onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
+
+Called when the system has decided to adjust the memory level. For example, this API can be used when there is not enough memory to run as many background processes as possible.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.|
+
+**Example**
+
+ ```js
+ class myAbility extends Ability {
+ onMemoryLevel(level) {
+ console.log('onMemoryLevel, level:' + JSON.stringify(level));
+ }
+ }
+ ```
+
## Caller
-Implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee).
+Implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability).
## Caller.call
@@ -310,19 +331,19 @@ Sends sequenceable data to the target ability.
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
+ | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<void> | Promise used to return a response.|
-
-**Example**
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<void> | Promise used to return a response.|
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{ // Custom sequenceable data structure
@@ -383,19 +404,19 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
+ | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.|
-
-**Example**
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.|
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
@@ -455,8 +476,8 @@ Releases the caller interface of the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
var caller;
@@ -492,12 +513,12 @@ Registers a callback that is invoked when the stub on the target ability is disc
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
-
-**Example**
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
var caller;
@@ -540,12 +561,13 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities.|
-| callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities.|
+ | callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
-**Example**
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
@@ -595,9 +617,9 @@ Deregisters a caller notification callback, which is invoked when the target abi
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Registered notification message string.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Registered notification message string.|
**Example**
@@ -618,17 +640,16 @@ Deregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.|
-
+| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.|
- ## CalleeCallBack
+## CalleeCallBack
(indata: rpc.MessageParcel): rpc.Sequenceable;
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.|
+| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.|
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
index ca3269353344ca06935afaf6b390ae0c906f1a1a..50e65757431e7df6b9bc784c6169da902a04bf5d 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
@@ -65,7 +65,7 @@ Enumerates ability continuation results.
## AbilityConstant.WindowMode
-Enumerates the window modes when an ability is started.
+Enumerates the window modes in which an ability can be displayed at startup.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -76,3 +76,15 @@ Enumerates the window modes when an ability is started.
| WINDOW_MODE_SPLIT_PRIMARY | 100 | The ability is displayed in the primary window in split-screen mode. |
| WINDOW_MODE_SPLIT_SECONDARY | 101 | The ability is displayed in the secondary window in split-screen mode. |
| WINDOW_MODE_FLOATING | 102 | The ability is displayed in a floating window.|
+
+## AbilityConstant.MemoryLevel
+
+Enumerates the memory levels.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Value| Description |
+| --- | --- | --- |
+| MEMORY_LEVEL_MODERATE | 0 | Moderate memory usage. |
+| MEMORY_LEVEL_LOW | 1 | Low memory usage. |
+| MEMORY_LEVEL_CRITICAL | 2 | High memory usage. |
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
index 542214482f3e5bc8a74dad3d9990e1817b3f02e8..1a6035f15c6d68dd374d21e1953163b57d1e7648 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
@@ -875,3 +875,265 @@ abilityDelegator.finishTest(msg, 0).then(() => {
console.info("finishTest promise");
});
```
+
+### addAbilityStageMonitor9+
+
+addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void;
+
+Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes of an ability stage. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+var abilityDelegator;
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.addAbilityStageMonitor(monitor, (err : any) => {
+ console.info("addAbilityStageMonitor callback");
+});
+```
+
+
+
+### addAbilityStageMonitor9+
+
+addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\;
+
+Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes of an ability stage. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+
+**Return value**
+
+| Type | Description |
+| -------------- | ------------------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+```js
+var abilityDelegator;
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.addAbilityStageMonitor(monitor).then(() => {
+ console.info("addAbilityStageMonitor promise");
+});
+```
+
+### removeAbilityStageMonitor9+
+
+removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void;
+
+Removes an **AbilityStageMonitor** instance from the application memory. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+var abilityDelegator;
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.removeAbilityStageMonitor(monitor, (err : any) => {
+ console.info("removeAbilityStageMonitor callback");
+});
+```
+
+
+
+### removeAbilityStageMonitor9+
+
+removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\;
+
+Removes an **AbilityStageMonitor** object from the application memory. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+
+**Return value**
+
+| Type | Description |
+| -------------- | ------------------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+```js
+var abilityDelegator;
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.removeAbilityStageMonitor(monitor).then(() => {
+ console.info("removeAbilityStageMonitor promise");
+});
+```
+
+### waitAbilityStageMonitor9+
+
+waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void;
+
+Waits for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned. |
+
+**Example**
+
+```js
+var abilityDelegator;
+
+function onAbilityCreateCallback(data) {
+ console.info("onAbilityCreateCallback");
+}
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.waitAbilityStageMonitor(monitor, (err : any, data : any) => {
+ console.info("waitAbilityStageMonitor callback");
+});
+```
+
+### waitAbilityStageMonitor9+
+
+waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise\;
+
+Waits for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+| timeout | number | No | Maximum waiting time, in milliseconds.|
+
+**Return value**
+
+| Type | Description |
+| -------------- | ------------------- |
+| Promise\ | Promise used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned.|
+
+**Example**
+
+```js
+var abilityDelegator;
+
+function onAbilityCreateCallback(data) {
+ console.info("onAbilityCreateCallback");
+}
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.waitAbilityStageMonitor(monitor).then((data : any) => {
+ console.info("waitAbilityStageMonitor promise");
+});
+```
+
+### waitAbilityStageMonitor9+
+
+waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback\): void;
+
+Waits a period of time for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.|
+| timeout | number | No | Maximum waiting time, in milliseconds.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned. |
+
+**Example**
+
+```js
+var abilityDelegator;
+var timeout = 100;
+
+function onAbilityCreateCallback(data) {
+ console.info("onAbilityCreateCallback");
+}
+
+var monitor = {
+ moduleName: "moduleName",
+ srcEntrance: "srcEntrance",
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.waitAbilityStageMonitor(monitor, timeout, (err : any, data : any) => {
+ console.info("waitAbilityStageMonitor callback");
+});
+```
+
+## AbilityStageMonitor
+
+Provides conditions for matching **AbilityStage** instances. The most recently matched **AbilityStage** instance is saved in an **AbilityStageMonitor** instance.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Type | Readable| Writable| Description |
+| ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ |
+| moduleName9+ | string | Yes | Yes | Module name of the **AbilityStage** instance.|
+| srcEntrance9+ | string | Yes | Yes | Source path of the **AbilityStage** instance.|
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
index dffe0e39e69e38123bf7e89338b3d4efb14ad82a..e1b3aa3bbe5e16262db584894055c090a224b625 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
@@ -11,7 +11,7 @@ The **AbilityDelegatorArgs** module provides a global register to store the regi
The ability delegator arguments are obtained by calling **getArguments** in **AbilityDelegatorRegistry**.
```js
-import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
var args = AbilityDelegatorRegistry.getArguments();
```
diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md
index 5817123ea55725ecd6c3c7a1f1d2a88b3f27b2ca..d1c8592f97d4c8b8799d5773b391bb1798663219 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md
@@ -89,6 +89,31 @@ Called when the global configuration is updated.
}
}
```
+
+## AbilityStage.onMemoryLevel
+
+onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
+
+Called when the system has decided to adjust the memory level. For example, this API can be used when there is not enough memory to run as many background processes as possible.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.|
+
+**Example**
+
+ ```js
+ class MyAbilityStage extends AbilityStage {
+ onMemoryLevel(level) {
+ console.log('onMemoryLevel, level:' + JSON.stringify(level));
+ }
+ }
+ ```
+
## AbilityStage.context
context: AbilityStageContext;
diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md
index 1b2bd22548deeed3145803c1a3939e59399b904c..9dc3ec0c3c5f022d4aecd438f59ebc830a34ae63 100644
--- a/en/application-dev/reference/apis/js-apis-appmanager.md
+++ b/en/application-dev/reference/apis/js-apis-appmanager.md
@@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example**
@@ -46,9 +46,9 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example**
@@ -72,9 +72,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example**
@@ -96,9 +96,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example**
@@ -119,9 +119,9 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<number> | Size of the application memory.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<number> | Size of the application memory.|
**Example**
@@ -143,9 +143,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<number> | No| Size of the application memory.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<number> | No| Size of the application memory.|
**Example**
@@ -157,14 +157,12 @@ Obtains the memory size of this application. This API uses an asynchronous callb
```
## appManager.getProcessRunningInfos(deprecated)
-> **NOTE**
->
-> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9) instead.
-
getProcessRunningInfos(): Promise\>;
Obtains information about the running processes. This API uses a promise to return the result.
+> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9) instead.
+
**Required permissions**: ohos.permission.GET_RUNNING_INFO
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -187,14 +185,12 @@ Obtains information about the running processes. This API uses a promise to retu
## appManager.getProcessRunningInfos(deprecated)
-> **NOTE**
->
-> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9-1) instead.
-
getProcessRunningInfos(callback: AsyncCallback\>): void;
Obtains information about the running processes. This API uses an asynchronous callback to return the result.
+> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9-1) instead.
+
**Required permissions**: ohos.permission.GET_RUNNING_INFO
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -228,7 +224,7 @@ Obtains information about the running processes. This API uses a promise to retu
| Type| Description|
| -------- | -------- |
-| Promise\> | Promise used to return the process information.|
+| Promise\> | Promise used to return the process information.|
**Example**
@@ -254,7 +250,7 @@ Obtains information about the running processes. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\> | No| Callback used to return the process information.|
+| callback | AsyncCallback\> | No| Callback used to return the process information.|
**Example**
@@ -269,7 +265,7 @@ Obtains information about the running processes. This API uses an asynchronous c
registerApplicationStateObserver(observer: ApplicationStateObserver): number;
-Registers an observer to listen for the state of all applications.
+Registers an observer to listen for the state changes of all applications.
**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER
@@ -307,9 +303,9 @@ Registers an observer to listen for the state of all applications.
## appManager.registerApplicationStateObserver9+
-registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number;
+registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array\): number;
-Registers an observer to listen for the state of a specified application.
+Registers an observer to listen for the state changes of a specified application.
**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER
@@ -322,7 +318,7 @@ Registers an observer to listen for the state of a specified application.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| observer | [ApplicationStateObserver](#applicationstateobserver) | No| Numeric code of the observer.|
-| bundleNameList | Array | No| **bundleName** array to be registered for listening. The maximum value is 128.|
+| bundleNameList | Array | No| **bundleName** array of the application. A maximum of 128 bundle names can be passed.|
**Example**
@@ -359,7 +355,7 @@ Deregisters the application state observer. This API uses an asynchronous callba
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
-
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| observerId | number | No| Numeric code of the observer.|
@@ -491,10 +487,10 @@ Kills a process by bundle name and account ID. This API uses a promise to return
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| bundleName | string | Yes| Bundle name of an application.|
-| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | Yes| Bundle name of an application.|
+ | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
**Example**
@@ -525,11 +521,11 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| bundleName | string | Yes| Bundle name of an application.|
-| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
-| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | Yes| Bundle name of an application.|
+ | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -708,9 +704,14 @@ Called when the application state changes.
**Example**
```js
-import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
-const foregroundApplicationInfo = ApplicationStateObserver.onForegroundApplicationChanged();
-console.log('-------- foregroundApplicationInfo: ---------', foregroundApplicationInfo);
+ var applicationStateObserver = {
+ onForegroundApplicationChanged(appStateData) {
+ console.log('------------ onForegroundApplicationChanged -----------', appStateData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
+
```
## ApplicationStateObserver.onAbilityStateChanged8+
@@ -732,9 +733,13 @@ Called when the ability state changes.
**Example**
```js
-import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
-const abilityStateChangedInfo = ApplicationStateObserver.onAbilityStateChanged();
-console.log('-------- abilityStateChangedInfo: ---------', abilityStateChangedInfo);
+ var applicationStateObserver = {
+ onAbilityStateChanged(abilityStateData) {
+ console.log('------------ onAbilityStateChanged -----------', abilityStateData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
```
## ApplicationStateObserver.onProcessCreated8+
@@ -756,9 +761,13 @@ Called when a process is created.
**Example**
```js
-import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
-const processCreatedInfo = ApplicationStateObserver.onProcessCreated();
-console.log('-------- processCreatedInfo: ---------', processCreatedInfo);
+ var applicationStateObserver = {
+ onProcessCreated(processData) {
+ console.log('------------ onProcessCreated -----------', processData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
```
## ApplicationStateObserver.onProcessDied8+
@@ -775,14 +784,46 @@ Called when a process is terminated.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| processData | ProcessData | No| Process information.|
+| processData | [ProcessData](#processdata) | No| Process information.|
**Example**
```js
-import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
-const processDiedInfo = ApplicationStateObserver.onProcessDied();
-console.log('-------- processDiedInfo: ---------', processDiedInfo);
+ var applicationStateObserver = {
+ onProcessDied(processData) {
+ console.log('------------ onProcessDied -----------', processData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
+```
+
+## ApplicationStateObserver.onProcessStateChanged9+
+
+ onProcessStateChanged(processData: ProcessData): void;
+
+Called when the process state changes.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| processData | [ProcessData](#processdata) | No| Process information.|
+
+**Example**
+
+```js
+ var applicationStateObserver = {
+ onProcessStateChanged(processData) {
+ console.log('------------ onProcessStateChanged -----------', processData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
```
## AppStateData
@@ -815,7 +856,7 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo);
## ProcessData
-**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
@@ -824,19 +865,19 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo);
| pid8+ | number | Yes | No | Process ID. |
| bundleName8+ | string | Yes | No | Bundle name of an application. |
| uid8+ | number | Yes | No | User ID. |
-
-
+| isContinuousTask9+ | boolean | Yes | No | Whether the process is a continuous task. |
+| isKeepAlive9+ | boolean | Yes | No | Whether the process remains active. |
## ProcessRunningInfo
-**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| pid9+ | Read only | number | No | Process ID. |
-| uid9+ | Read only | number | No | User ID.|
-| processName9+ | Read only | string | No | Process name.|
-| bundleNames9+ | Read only | Array\ | No | **bundleName** array in the running processes.|
+| pid8+ | Read only | number | No | Process ID. |
+| uid8+ | Read only | number | No | User ID.|
+| processName8+ | Read only | string | No | Process name.|
+| bundleNames8+ | Read only | Array\ | No | **bundleName** array in the running processes.|
## ApplicationStateObserver
@@ -850,3 +891,44 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo);
| [onAbilityStateChanged8+](#applicationstateobserveronabilitystatechanged8) | AsyncCallback\ | Yes | No | Callback invoked when the ability state changes. |
| [onProcessCreated8+](#applicationstateobserveronprocesscreated8) | AsyncCallback\ | Yes | No | Callback invoked when a process is created. |
| [onProcessDied8+](#applicationstateobserveronprocessdied8) | AsyncCallback\ | Yes | No | Callback invoked when a process is destroyed. |
+
+## ProcessRunningInformation
+
+Defines the process running information.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Readable/Writable| Type | Mandatory| Description |
+| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
+| pid9+ | Read only | number | No | Process ID. |
+| uid9+ | Read only | number | No | User ID.|
+| processName9+ | Read only | string | No | Process name.|
+| bundleNames9+ | Read only | Array\ | No | **bundleName** array in the running processes.|
+
+## ApplicationState9+
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Value | Description |
+| -------------------- | --- | --------------------------------- |
+| STATE_CREATE | 1 | State indicating that the application is being created. |
+| STATE_FOREGROUND | 2 | State indicating that the application is running in the foreground. |
+| STATE_ACTIVE | 3 | State indicating that the application is active. |
+| STATE_BACKGROUND | 4 | State indicating that the application is running in the background. |
+| STATE_DESTROY | 5 | State indicating that the application is destroyed. |
+
+## ProcessState9+
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Value | Description |
+| -------------------- | --- | --------------------------------- |
+| STATE_CREATE | 1 | State indicating that the process is being created. |
+| STATE_FOREGROUND | 2 | State indicating that the process is running in the foreground. |
+| STATE_ACTIVE | 3 | State indicating that the process is active. |
+| STATE_BACKGROUND | 4 | State indicating that the process is running in the background. |
+| STATE_DESTROY | 5 | State indicating that the process is destroyed. |
diff --git a/en/application-dev/reference/apis/js-apis-arraylist.md b/en/application-dev/reference/apis/js-apis-arraylist.md
index 341295a167878f6c3696efe01f15a29415f91cd8..0618e40a4327d72455405588df46c9f91f7262e4 100644
--- a/en/application-dev/reference/apis/js-apis-arraylist.md
+++ b/en/application-dev/reference/apis/js-apis-arraylist.md
@@ -12,6 +12,9 @@ When compared with **[LinkedList](js-apis-linkedlist.md)**, **ArrayList** is mor
**Recommended use case**: Use **ArrayList** when elements in a container need to be frequently read.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -72,7 +75,7 @@ Adds an element at the end of this container.
let result1 = arrayList.add(1);
let b = [1, 2, 3];
let result2 = arrayList.add(b);
- let c = {name: "lala", age: "13"};
+ let c = {name: "Dylon", age: "13"};
let result3 = arrayList.add(false);
```
@@ -124,9 +127,9 @@ Checks whether this container has the specified element.
```ts
let arrayList = new ArrayList();
-let result = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-arrayList.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-let result1 = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = arrayList.has("squirrel");
+arrayList.add("squirrel");
+let result1 = arrayList.has("squirrel");
```
### getIndexOf
@@ -361,7 +364,7 @@ arrayList.add(4);
arrayList.add(5);
arrayList.add(4);
arrayList.forEach((value, index) => {
- console.log("value:" + value, index);
+ console.log(`value:${value}`, index);
});
```
@@ -623,14 +626,14 @@ arrayList.add(4);
// Method 1:
for (let item of arrayList) {
- console.log("value:" + item);
+ console.log(`value:${item}`);
}
// Method 2:
let iter = arrayList[Symbol.iterator]();
let temp = iter.next().value;
while(temp != undefined) {
- console.log("value:" + temp);
+ console.log(`value:${temp}`);
temp = iter.next().value;
}
```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md
index e7bcef69308231e54d2786e4324969a3b0444923..eb54d689022397f603f9d93d2cc8591d9d1cdc82 100644
--- a/en/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-bluetooth.md
@@ -1,6 +1,6 @@
# Bluetooth
-The Bluetooth module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
+The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
> **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.
@@ -281,7 +281,7 @@ let remoteDeviceName = bluetooth.getRemoteDeviceName("XX:XX:XX:XX:XX:XX");
getRemoteDeviceClass(deviceId: string): DeviceClass
-Obtains the type of the remote Bluetooth device.
+Obtains the class of the remote Bluetooth device.
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -297,7 +297,7 @@ Obtains the type of the remote Bluetooth device.
| Type | Description |
| --------------------------- | -------- |
-| [DeviceClass](#deviceclass) | Type of a remote device obtained.|
+| [DeviceClass](#deviceclass) | Class of the remote device obtained.|
**Example**
@@ -389,7 +389,7 @@ startBluetoothDiscovery(): boolean
Starts Bluetooth scan to discover remote devices.
-**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
+**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -515,7 +515,7 @@ Unsubscribes from the Bluetooth device discovery events.
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered. |
-| callback | Callback<Array<string>> | No | Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<Array<string>> | No | Callback for the **bluetoothDeviceFind** event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -578,7 +578,7 @@ Unsubscribes from the pairing request events of the remote Bluetooth device.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. |
-| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No | Callback used to report the Bluetooth pairing request. The input parameter is the pairing request parameter. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No | Callback for the Bluetooth pairing request event. The input parameter is the pairing request parameter. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -599,7 +599,7 @@ bluetooth.off('pinRequired', onReceiveEvent);
on(type: "bondStateChange", callback: Callback<BondStateParam>): void
-Subscribes to the Bluetooth bond state change events.
+Subscribes to the Bluetooth pairing state change events.
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -609,8 +609,8 @@ Subscribes to the Bluetooth bond state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------------ |
-| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth bond state change event.|
-| callback | Callback<[BondStateParam](#BondStateParam)> | Yes | Callback invoked to return the bond state. You need to implement this callback. |
+| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event.|
+| callback | Callback<[BondStateParam](#BondStateParam)> | Yes | Callback invoked to return the pairing state. You need to implement this callback. |
**Return value**
@@ -619,7 +619,7 @@ No value is returned.
**Example**
```js
-function onReceiveEvent(data) { // data, as the input parameter of the callback, indicates the bond state.
+function onReceiveEvent(data) { // data, as the input parameter of the callback, indicates the pairing state.
console.info('pair state = '+ JSON.stringify(data));
}
bluetooth.on('bondStateChange', onReceiveEvent);
@@ -630,7 +630,7 @@ bluetooth.on('bondStateChange', onReceiveEvent);
off(type: "bondStateChange", callback?: Callback<BondStateParam>): void
-Unsubscribes from the Bluetooth bond state change events.
+Unsubscribes from the Bluetooth pairing state change events.
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -640,8 +640,8 @@ Unsubscribes from the Bluetooth bond state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth bond state change event. |
-| callback | Callback<[BondStateParam](#BondStateParam)> | No | Callback used to report the change of the Bluetooth bond state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event. |
+| callback | Callback<[BondStateParam](#BondStateParam)> | No | Callback for the change of the Bluetooth pairing state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -704,7 +704,7 @@ Unsubscribes from the Bluetooth connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **stateChange** indicates a Bluetooth connection state change event. |
-| callback | Callback<[BluetoothState](#bluetoothstate)> | No | Callback used to report the Bluetooth connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[BluetoothState](#bluetoothstate)> | No | Callback for the Bluetooth connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -990,7 +990,7 @@ Unsubscribes from the SPP read request events.
| ------------ | --------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **sppRead** indicates an SPP read request event. |
| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**. |
-| callback | Callback<ArrayBuffer> | No | Callback used to report an SPP read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<ArrayBuffer> | No | Callback for the SPP read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -1248,7 +1248,7 @@ Unsubscribes from the BLE device discovery events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered. |
-| callback | Callback<Array<[ScanResult](#scanresult)>> | No | Callback used to report the discovered devices. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<Array<[ScanResult](#scanresult)>> | No | Callback for the **BLEDeviceFind** event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -1558,7 +1558,7 @@ Subscribes to the HFP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback used to return the HFP connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HFP connection state change event. |
**Return value**
@@ -1588,7 +1588,7 @@ Unsubscribes from the HFP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the HFP connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HFP connection state change event. |
**Return value**
@@ -1718,7 +1718,7 @@ Unsubscribes from the HidHost connection state change events.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the HidHost connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HidHost connection state change event. |
**Return value**
@@ -1786,7 +1786,7 @@ Subscribes to the PAN connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback used to return the PAN connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the PAN connection state change event. |
**Return value**
@@ -1816,7 +1816,7 @@ Unsubscribes from the PAN connection state change events.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the PAN connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the PAN connection state change event. |
**Return value**
@@ -2061,10 +2061,9 @@ Removes a service from this GATT server.
**Return value**
-| | |
+| Type | Description |
| ------- | -------------------------- |
-| Type | Description |
-| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
@@ -2111,10 +2110,9 @@ Notifies the connected client device when a characteristic value changes.
**Return value**
-| | |
+| Type | Description |
| ------- | ------------------------ |
-| Type | Description |
-| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
@@ -2156,10 +2154,9 @@ Sends a response to a read or write request from the GATT client.
**Return value**
-| | |
+| Type | Description |
| ------- | -------------------------- |
-| Type | Description |
-| boolean | Returns **true** if the operation is successful; returns **false** otherwise. |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
@@ -2249,7 +2246,7 @@ Unsubscribes from the characteristic read request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **characteristicRead** indicates a characteristic read request event. |
-| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | No | Callback used to report a characteristic read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[CharacteristicReadReq](#characteristicreadreq)> | No | Callback for the characteristic read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -2329,7 +2326,7 @@ Unsubscribes from the characteristic write request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event. |
-| callback | Callback<[CharacteristicWriteReq](#characteristicwritereq)> | No | Callback used to report a characteristic write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[CharacteristicWriteReq](#characteristicwritereq)> | No | Callback for the characteristic write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -2406,7 +2403,7 @@ Unsubscribes from the descriptor read request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event. |
-| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | No | Callback used to report a descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | No | Callback for the descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -2486,7 +2483,7 @@ Unsubscribes from the descriptor write request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event. |
-| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | No | Callback used to report a descriptor write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[DescriptorWriteReq](#descriptorwritereq)> | No | Callback for the descriptor write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -2499,6 +2496,7 @@ let gattServer = bluetooth.BLE.createGattServer();
gattServer.off("descriptorWrite");
```
+
### on('connectStateChange')
on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void
@@ -2548,7 +2546,7 @@ Unsubscribes from the BLE connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectStateChange** indicates a BLE connection state change event.|
-| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -2785,10 +2783,9 @@ Reads the characteristic value of the specific service of the remote BLE device.
**Return value**
-| | |
+| Type | Description |
| ---------------------------------------- | -------------------------- |
-| Type | Description |
-| Promise<[BLECharacteristic](#blecharacteristic)> | Promise used to return the characteristic value read. |
+| Promise<[BLECharacteristic](#blecharacteristic)> | Promise used to return the characteristic value read.|
**Example**
@@ -2876,10 +2873,9 @@ Reads the descriptor contained in the specific characteristic of the remote BLE
**Return value**
-| | |
+| Type | Description |
| ---------------------------------------- | -------------------------- |
-| Type | Description |
-| Promise<[BLEDescriptor](#bledescriptor)> | Promise used to return the descriptor read. |
+| Promise<[BLEDescriptor](#bledescriptor)> | Promise used to return the descriptor read.|
**Example**
@@ -2990,7 +2986,7 @@ if (retWriteDesc) {
setBLEMtuSize(mtu: number): boolean
-Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This method can be used only after a connection is set up by calling [connect](#connect).
+Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This API can be used only after a connection is set up by calling [connect](#connect).
**Required permissions**: ohos.permission.USE_BLUETOOTH
@@ -3108,7 +3104,7 @@ Unsubscribes from the BLE characteristic change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.|
-| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No | Callback used to report the characteristic value. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No | Callback for the characteristic value change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -3170,7 +3166,7 @@ Unsubscribes from the BLE connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.|
-| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback used to report the BLE connection state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
+| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.|
**Return value**
@@ -3671,13 +3667,13 @@ Defines the pairing request parameters.
## BondStateParam8+
-Defines the bond state parameters.
+Defines the pairing state parameters.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ----------- |
-| deviceId | string | Yes | No | ID of the device.|
+| deviceId | string | Yes | No | ID of the device to pair.|
| state | BondState | Yes | No | State of the device.|
diff --git a/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
index 9b11bb2f18da535af770b96cda13981cef95c62a..5457c4e3154da06f26045b06b7c196eb1c5dd75d 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
@@ -1,13 +1,11 @@
# ExtensionAbilityInfo
-
+The **ExtensionAbilityInfo** module provides Extension ability information. Unless otherwise specified, all attributes are obtained through [getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfo), and flags are obtained through [GET_BUNDLE_DEFAULT](js-apis-Bundle.md#bundleflag).
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-The **ExtensionAbilityInfo** module provides Extension ability information. Unless otherwise specified, all attributes are obtained through **GET_BUNDLE_DEFAULT**.
-
## ExtensionAbilityInfo
**System capability**: SystemCapability.BundleManager.BundleFramework
diff --git a/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md
index 3a00ac698a3529d153ef3741979238569555f12c..ef19c14e94b36ba0f0677d8bdc35f362f709a7ae 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md
@@ -1,6 +1,6 @@
# LauncherAbilityInfo
-The **LauncherAbilityInfo** module provides information about a launcher ability.
+The **LauncherAbilityInfo** module provides information about the launcher ability, which is obtained through [innerBundleManager.getLauncherAbilityInfos](js-apis-Bundle-InnerBundleManager.md).
> **NOTE**
>
@@ -12,8 +12,8 @@ The **LauncherAbilityInfo** module provides information about a launcher ability
**System API**: This is a system API and cannot be called by third-party applications.
-| Name | Type | Readable| Writable| Description |
-| --------------- | ---------------------------------------------------- | ---- | ---- | ------------------------------------ |
+| Name | Type | Readable| Writable| Description |
+| --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- |
| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application information of the launcher ability.|
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name of the launcher ability. |
| labelId | number | Yes | No | Label ID of the launcher ability. |
diff --git a/en/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md b/en/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md
index d45f34389b0cf049376e282fb2fdf2a2f3130075..9e70a90e4fc19197ebd37021ad3326ab64c3ccfc 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md
@@ -1,6 +1,6 @@
# ShortcutInfo
-The **ShortcutInfo** module provides shortcut information defined in the configuration file.
+The **ShortcutInfo** module provides shortcut information defined in the configuration file. For details about the configuration in the FA model, see [config.json](../../quick-start/package-structure.md). For details about the configuration in the stage model, see [Internal Structure of the shortcuts Attribute](../../quick-start/stage-structure.md#internal-structure-of-the-shortcuts-attribute).
> **NOTE**
>
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index ac82d0b2e610751bd000849ec35337363b0dcb3a..9b20ccb9f359ed6f8109d3fc57fdebd9d4d728ed 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -824,11 +824,8 @@ This is a system API.
**Example**
```js
-let promise = call.reject(1);
-promise.then(data => {
- console.log(`reject success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
- console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
+call.reject(1, (error, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 78db0562f97cf687e26c210d870519c829b691ee..5d57d317cb2a4ae2fa0e7ba29e61a23d95c8dbd1 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -812,7 +812,7 @@ Obtains the zoom ratio range. This API uses an asynchronous callback to return t
| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ------------------------ |
-| callback | AsyncCallback\> | Yes | Callback used to return the result.|
+| callback | AsyncCallback\> | Yes | Callback used to return an array containing the minimum and maximum zoom ratios.|
**Example**
@@ -838,7 +838,7 @@ Obtains the zoom ratio range. This API uses a promise to return the result.
| Type | Description |
| ------------------------ | ------------------------------------------- |
-| Promise\> | Promise used to return the zoom ratio range.|
+| Promise\> | Promise used to return an array containing the minimum and maximum zoom ratios.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-commonEvent.md b/en/application-dev/reference/apis/js-apis-commonEvent.md
index 710d6ccb8820e88ed98e3519c36824efdd5e5b17..50fad38058530104fda01f09d5745c0f8051000a 100644
--- a/en/application-dev/reference/apis/js-apis-commonEvent.md
+++ b/en/application-dev/reference/apis/js-apis-commonEvent.md
@@ -66,15 +66,11 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_USER_STARTED | usual.event.USER_STARTED | - | Indicates the common event that the user has been started. |
| COMMON_EVENT_USER_BACKGROUND | usual.event.USER_BACKGROUND | - | Indicates the common event that the user has been brought to the background. |
| COMMON_EVENT_USER_FOREGROUND | usual.event.USER_FOREGROUND | - | Indicates the common event that the user has been brought to the foreground. |
-| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_USERS | Indicates the common event that user switching is happening. |
-| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_USERS | Indicates the common event that the user is going to be started. |
+| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that user switching is happening. |
+| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be started. |
| COMMON_EVENT_USER_UNLOCKED | usual.event.USER_UNLOCKED | - | Indicates the common event that the credential-encrypted storage has been unlocked for the current user when the device is unlocked after being restarted. |
-| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_USERS | Indicates the common event that the user is going to be stopped. |
+| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be stopped. |
| COMMON_EVENT_USER_STOPPED | usual.event.USER_STOPPED | - | Indicates the common event that the user has been stopped. |
-| COMMON_EVENT_HWID_LOGIN | common.event.HWID_LOGIN | - | Indicates the common event about a HUAWEI ID login. |
-| COMMON_EVENT_HWID_LOGOUT | common.event.HWID_LOGOUT | - | Indicates the common event about a HUAWEI ID logout. |
-| COMMON_EVENT_HWID_TOKEN_INVALID | common.event.HWID_TOKEN_INVALID | - | Indicates the common event that the HUAWEI ID is invalid. |
-| COMMON_EVENT_HWID_LOGOFF | common.event.HWID_LOGOFF | - | Indicates the common event about a HUAWEI ID logoff. |
| COMMON_EVENT_WIFI_POWER_STATE | usual.event.wifi.POWER_STATE | - | Indicates the common event about the Wi-Fi network state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_SCAN_FINISHED | usual.event.wifi.SCAN_FINISHED | ohos.permission.LOCATION | Indicates the common event that the Wi-Fi access point has been scanned and proven to be available. |
| COMMON_EVENT_WIFI_RSSI_VALUE | usual.event.wifi.RSSI_VALUE | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi signal strength (RSSI) has changed. |
@@ -133,8 +129,8 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_CHARGING | usual.event.CHARGING | - | Indicates the common event that the system starts charging the battery. |
| COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED | usual.event.DEVICE_IDLE_MODE_CHANGED | - | Indicates the common event that the system idle mode has changed. |
| COMMON_EVENT_POWER_SAVE_MODE_CHANGED | usual.event.POWER_SAVE_MODE_CHANGED | - | Indicates the common event that the power saving mode of the system has changed. |
-| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_USERS | Indicates the common event that a user has been added to the system. |
-| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_USERS | Indicates the common event that a user has been removed from the system. |
+| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been added to the system. |
+| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been removed from the system. |
| COMMON_EVENT_ABILITY_ADDED | usual.event.ABILITY_ADDED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been added. |
| COMMON_EVENT_ABILITY_REMOVED | usual.event.ABILITY_REMOVED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been removed. |
| COMMON_EVENT_ABILITY_UPDATED | usual.event.ABILITY_UPDATED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been updated. |
diff --git a/en/application-dev/reference/apis/js-apis-deque.md b/en/application-dev/reference/apis/js-apis-deque.md
index 8d9a9c1b42bef6ce74fdfb21a8033b80e68c1868..973cdfb78725ba03576d7cc6a561c71e6930aeb2 100644
--- a/en/application-dev/reference/apis/js-apis-deque.md
+++ b/en/application-dev/reference/apis/js-apis-deque.md
@@ -8,10 +8,13 @@ Double-ended queue (deque) is a sequence container implemented based on the queu
**Queue** follows the principle of FIFO only and allows element removal at the front and insertion at the rear.
-**Vector** supports insertion and deletion of elements in between, as well asat both the ends. When compared with **Vector**, **Deque** is more efficient in inserting and removing header elements, but less efficient in accessing elements.
+**Vector** supports insertion and deletion of elements in between, as well as at both the ends. When compared with **Vector**, **Deque** is more efficient in inserting and removing header elements, but less efficient in accessing elements.
**Recommended use case**: Use **Deque** when you need to frequently insert or remove elements at both the ends of a container.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -64,7 +67,7 @@ deque.insertFront("a");
deque.insertFront(1);
let b = [1, 2, 3];
deque.insertFront(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
deque.insertFront(false);
```
@@ -90,7 +93,7 @@ deque.insertEnd("a");
deque.insertEnd(1);
let b = [1, 2, 3];
deque.insertEnd(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
deque.insertEnd(false);
```
@@ -118,9 +121,9 @@ Checks whether this container has the specified element.
```ts
let deque = new Deque();
-let result = deque.has("Ahfbrgrbgnutfodgorrogorg");
-deque.insertFront("Ahfbrgrbgnutfodgorrogorg");
-let result1 = deque.has("Ahfbrgrbgnutfodgorrogorg");
+let result = deque.has("squirrel");
+deque.insertFront("squirrel");
+let result1 = deque.has("squirrel");
```
### popFirst
diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
index 8d18622ce2eb432210858545308e2a607891b1f0..81ee6f74b796de60b190f06b3f2a8a719f8569c3 100644
--- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
+++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
@@ -484,9 +484,9 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses a
## bundleState.getRecentlyUsedModules9+
-getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void
+getRecentlyUsedModules(callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void
-Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
+This API uses an asynchronous callback to return at most 1000 records sorted by time (most recent first).
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
@@ -498,13 +498,12 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
-| maxNum | number | No | Maximum number of returned records. The maximum and default value is **1000**. If this parameter is not specified, **1000** is used. |
| callback | AsyncCallback<Array<[BundleActiveModuleInfo](#bundleactivemoduleinfo9)>> | Yes | Callback used to return the result.|
**Example**
```js
- bundleState.getRecentlyUsedModules(1000,(err, res) => {
+ bundleState.getRecentlyUsedModules((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
@@ -513,11 +512,33 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
}
- }
+ }
});
+ ```
- // Invocation when maxNum is not passed
- bundleState.getRecentlyUsedModules((err, res) => {
+## bundleState.getRecentlyUsedModules9+
+
+getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void
+
+Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
+
+**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
+
+**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ----------------------------------- |
+| maxNum | number | Yes | Maximum number of returned records. The maximum and default value is **1000**.|
+| callback | AsyncCallback<Array<[BundleActiveModuleInfo](#bundleactivemoduleinfo9)>> | Yes | Callback used to return the result.|
+
+**Example**
+
+ ```js
+ bundleState.getRecentlyUsedModules(1000,(err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
@@ -526,7 +547,7 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
}
- }
+ }
});
```
@@ -574,9 +595,9 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup9+
-queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void
+queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void
-Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.
+Queries the priority group of the current application . This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
@@ -588,23 +609,44 @@ Queries the priority group of the application specified by **bundleName**. If **
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
-| bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.|
| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
**Example**
```javascript
-// Callback with bundleName
-let bundleName = "com.ohos.camera";
-bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
+bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
-// Callback without bundleName
-bundleState.queryAppUsagePriorityGroup((err, res) => {
+```
+
+## bundleState.queryAppUsagePriorityGroup9+
+
+queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback<number>): void
+
+Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
+
+**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | --------------------- | ---- | ---------------------------------------- |
+| bundleName | string | Yes | Bundle name of the target application.|
+| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
+
+**Example**
+
+```javascript
+let bundleName = "com.ohos.camera";
+bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
@@ -688,7 +730,7 @@ bundleState.setBundleGroup(bundleName, newGroup, (err) => {
## bundleState.registerGroupCallBack9+
-registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>): Promise<void>
+registerGroupCallBack(groupCallback: Callback<BundleActiveGroupCallbackInfo>): Promise<void>
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result.
@@ -730,7 +772,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
## bundleState.registerGroupCallBack9+
-registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void
+registerGroupCallBack(groupCallback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.
@@ -1034,20 +1076,6 @@ Provides the usage duration information of applications.
| infosBeginTime | number | No | Time logged in the first application usage record in the **BundleActiveInfo** object. This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| infosEndTime | number | No | Time logged in the last application usage record in the **BundleActiveInfo** object. This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
-### merge
-
-merge(toMerge: BundleStateInfo): void
-
-Merges the application usage information that has the same bundle name.
-
-**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
-
-**Parameters**
-
-| Name | Type | Mandatory | Description |
-| ------- | ----------------------------------- | ---- | -------------- |
-| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes | Application usage information to merge.|
-
## BundleActiveState
Provides information about an application event.
diff --git a/en/application-dev/reference/apis/js-apis-effectKit.md b/en/application-dev/reference/apis/js-apis-effectKit.md
index 498bc3beb398e1f7b3b6fc20657ef01fec0b8bb1..cf2bb656da8705ff8352e00a06ce9149980959a4 100644
--- a/en/application-dev/reference/apis/js-apis-effectKit.md
+++ b/en/application-dev/reference/apis/js-apis-effectKit.md
@@ -4,7 +4,7 @@ The **EffectKit** module provides basic image processing capabilities, including
This module provides the following classes:
-- [Filter](#filter): a class that provides the effect chain.
+- [Filter](#filter): a class that provides the effect chain, which is a linked list of image processing effects.
- [Color](#color): a class used to store the color picked.
- [ColorPicker](#colorpicker): a smart color picker.
@@ -155,7 +155,7 @@ Obtains the main color of the image and writes the result to a **[Color](#color)
```js
colorPicker.getMainColor().then(color => {
console.log('Succeeded in getting main color.');
- console.info("color[ARGB]=" + color.alpha + "," + color.red + "," + color.green + "," + color.blue);
+ console.info(`color[ARGB]=${color.alpha},${color.red},${color.green},${color.blue}`);
}).catch(error => {
console.log('Failed to get main color.');
})
diff --git a/en/application-dev/reference/apis/js-apis-formInfo.md b/en/application-dev/reference/apis/js-apis-formInfo.md
index 950da73f21bd3ac1ee8e8fe8a57989714a95d6dd..8acf0e5e3e1ccb81b2295b03c65ed8fd812efa8e 100644
--- a/en/application-dev/reference/apis/js-apis-formInfo.md
+++ b/en/application-dev/reference/apis/js-apis-formInfo.md
@@ -3,7 +3,7 @@
The **FormInfo** module provides widget information and state.
> **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.
## Modules to Import
@@ -120,3 +120,14 @@ Enumerates the widget dimensions.
| Dimension_2_49+ | 3 | 2 x 4. |
| Dimension_4_49+ | 4 | 4 x 4. |
| Dimension_2_19+ | 5 | 2 x 1. |
+
+
+## FormInfoFilter
+
+Defines the widget information filter. Only the widget information that meets the filter is returned.
+
+**System capability**: SystemCapability.Ability.Form
+
+| Name | Yes | Description |
+| ----------- | ---- | ------------ |
+| moduleName9+ | No | Module name.|
diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md
index fbe8907aed6b59d005f027af62ec4d0b0ec9a141..8ce539886e5460ffe712b486addf6e3813c44a90 100644
--- a/en/application-dev/reference/apis/js-apis-formprovider.md
+++ b/en/application-dev/reference/apis/js-apis-formprovider.md
@@ -3,7 +3,7 @@
The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and request a widget release.
> **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.
## Modules to Import
@@ -183,7 +183,7 @@ Obtains the application's widget information that meets a filter criterion on th
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
-| filter | formInfo.FormInfoFilter | Yes| Filter criterion.|
+| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md#forminfofilter) | Yes| Filter criterion.|
| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.|
**Example**
@@ -214,7 +214,7 @@ Obtains the application's widget information on the device. This API uses a prom
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
-| filter | formInfo.FormInfoFilter | No| Filter criterion.|
+| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md) | No| Filter criterion.|
**Return value**
diff --git a/en/application-dev/reference/apis/js-apis-hashmap.md b/en/application-dev/reference/apis/js-apis-hashmap.md
index d1ac45e3bd10590be109ded2095405e4dee962de..5cf52af02dd7e1c36469882706ef2e0533cc5a5c 100644
--- a/en/application-dev/reference/apis/js-apis-hashmap.md
+++ b/en/application-dev/reference/apis/js-apis-hashmap.md
@@ -12,6 +12,10 @@
**Recommended use case**: Use **HashMap** when you need to quickly access, remove, and insert key-value pairs.
+This topic uses the following to identify the use of generics:
+- K: Key
+- V: Value
+
## Modules to Import
```ts
@@ -90,9 +94,9 @@ Checks whether this container contains the specified key.
```ts
let hashMap = new HashMap();
-let result = hashMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-let result1 = hashMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = hashMap.hasKey("squirrel");
+hashMap.set("squirrel", 123);
+let result1 = hashMap.hasKey("squirrel");
```
@@ -121,7 +125,7 @@ Checks whether this container contains the specified value.
```ts
let hashMap = new HashMap();
let result = hashMap.hasValue(123);
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+hashMap.set("squirrel", 123);
let result1 = hashMap.hasValue(123);
```
@@ -150,9 +154,9 @@ Obtains the value of the specified key in this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
-let result = hashMap.get("sdfs");
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
+let result = hashMap.get("sparrow");
```
@@ -174,8 +178,8 @@ Adds all elements in a **HashMap** instance to this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
let newHashMap = new HashMap();
hashMap.setAll(newHashMap);
```
@@ -194,7 +198,7 @@ Adds an element to this container.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | K | Yes| Key of the target element.|
-| value | V | Yes| Value of the element.|
+| value | V | Yes| Value of the target element.|
**Return value**
@@ -206,7 +210,7 @@ Adds an element to this container.
```ts
let hashMap = new HashMap();
-let result = hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+let result = hashMap.set("squirrel", 123);
```
@@ -234,9 +238,9 @@ Removes an element with the specified key from this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
-let result = hashMap.remove("sdfs");
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
+let result = hashMap.remove("sparrow");
```
@@ -252,8 +256,8 @@ Clears this container and sets its length to **0**.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
hashMap.clear();
```
@@ -276,8 +280,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
let iter = hashMap.keys();
let temp = iter.next().value;
while(temp != undefined) {
@@ -305,8 +309,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
let iter = hashMap.values();
let temp = iter.next().value;
while(temp != undefined) {
@@ -341,8 +345,8 @@ Replaces an element in this container.
```ts
let hashMap = new HashMap();
-hashMap.set("sdfs", 123);
-let result = hashMap.replace("sdfs", 357);
+hashMap.set("sparrow", 123);
+let result = hashMap.replace("sparrow", 357);
```
@@ -372,8 +376,8 @@ callbackfn
```ts
let hashMap = new HashMap();
-hashMap.set("sdfs", 123);
-hashMap.set("dfsghsf", 357);
+hashMap.set("sparrow", 123);
+hashMap.set("gull", 357);
hashMap.forEach((value, key) => {
console.log("value:" + value, key);
});
@@ -398,8 +402,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
let iter = hashMap.entries();
let temp = iter.next().value;
while(temp != undefined) {
@@ -427,8 +431,8 @@ Obtains an iterator, each item of which is a JavaScript object.
**Example**
```ts
let hashMap = new HashMap();
-hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-hashMap.set("sdfs", 356);
+hashMap.set("squirrel", 123);
+hashMap.set("sparrow", 356);
// Method 1:
for (let item of hashMap) {
diff --git a/en/application-dev/reference/apis/js-apis-hashset.md b/en/application-dev/reference/apis/js-apis-hashset.md
index 85bbfa2719412099c1d051de61b3c39363872b27..6568c856e715a5f86da527aea4c5ce3888537bc5 100644
--- a/en/application-dev/reference/apis/js-apis-hashset.md
+++ b/en/application-dev/reference/apis/js-apis-hashset.md
@@ -10,6 +10,9 @@ Unlike [TreeSet](js-apis-treeset.md), which stores and accesses data in sorted o
**Recommended use case**: Use **HashSet** when you need a set that has only unique elements or need to deduplicate a set.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -26,6 +29,17 @@ import HashSet from '@ohos.util.HashSet';
| -------- | -------- | -------- | -------- | -------- |
| length | number | Yes| No| Number of elements in a hash set (called container later).|
+**Example**
+
+```ts
+let hashSet = new HashSet();
+hashSet.add(1);
+hashSet.add(2);
+hashSet.add(3);
+hashSet.add(4);
+hashSet.add(5);
+let res = hashSet.length;
+```
### constructor
@@ -88,9 +102,9 @@ Checks whether this container contains the specified element.
```ts
let hashSet = new HashSet();
-let result = hashSet.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-let result1 = hashSet.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = hashSet.has("squirrel");
+hashSet.add("squirrel");
+let result1 = hashSet.has("squirrel");
```
@@ -118,7 +132,7 @@ Adds an element to this container.
```ts
let hashSet = new HashSet();
-let result = hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = hashSet.add("squirrel");
```
@@ -146,9 +160,9 @@ Removes an element from this container.
```ts
let hashSet = new HashSet();
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("sdfs");
-let result = hashSet.remove("sdfs");
+hashSet.add("squirrel");
+hashSet.add("sparrow");
+let result = hashSet.remove("sparrow");
```
@@ -164,8 +178,8 @@ Clears this container and sets its length to **0**.
```ts
let hashSet = new HashSet();
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("sdfs");
+hashSet.add("squirrel");
+hashSet.add("sparrow");
hashSet.clear();
```
@@ -188,8 +202,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let hashSet = new HashSet();
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("sdfs");
+hashSet.add("squirrel");
+hashSet.add("sparrow");
let iter = hashSet.values();
let temp = iter.next().value;
while(temp != undefined) {
@@ -225,8 +239,8 @@ callbackfn
```ts
let hashSet = new HashSet();
-hashSet.add("sdfs");
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+hashSet.add("sparrow");
+hashSet.add("squirrel");
hashSet.forEach((value, key) => {
console.log("value:" + value, key);
});
@@ -250,8 +264,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let hashSet = new HashSet();
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("sdfs");
+hashSet.add("squirrel");
+hashSet.add("sparrow");
let iter = hashSet.entries();
let temp = iter.next().value;
while(temp != undefined) {
@@ -280,8 +294,8 @@ Obtains an iterator, each item of which is a JavaScript object.
```ts
let hashSet = new HashSet();
-hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-hashSet.add("sdfs");
+hashSet.add("squirrel");
+hashSet.add("sparrow");
// Method 1:
for (let item of hashSet) {
diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md
index dc6d5ed6e1c8589733ee79c22cf3b413d7f80141..255c867d802b2f600c4792cd713a891b0e46e67e 100644
--- a/en/application-dev/reference/apis/js-apis-i18n.md
+++ b/en/application-dev/reference/apis/js-apis-i18n.md
@@ -26,6 +26,7 @@ Obtains the localized script for the specified language.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------------ | ------- | ---- | ---------------- |
| language | string | Yes | Specified language. |
@@ -33,6 +34,7 @@ Obtains the localized script for the specified language.
| sentenceCase | boolean | No | Whether to use sentence case for the localized script.|
**Return value**
+
| Type | Description |
| ------ | ------------- |
| string | Localized script for the specified language.|
@@ -53,6 +55,7 @@ Obtains the localized script for the specified country.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------------ | ------- | ---- | ---------------- |
| country | string | Yes | Specified country. |
@@ -60,6 +63,7 @@ Obtains the localized script for the specified country.
| sentenceCase | boolean | No | Whether to use sentence case for the localized script.|
**Return value**
+
| Type | Description |
| ------ | ------------- |
| string | Localized script for the specified country.|
@@ -80,11 +84,13 @@ Checks whether the localized script for the specified language is displayed from
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Description |
| ------ | ------ | ------- |
| locale | string | Locale ID.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the localized script is displayed from right to left; returns **false** otherwise.|
@@ -105,6 +111,7 @@ Obtains the system language.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------- |
| string | System language ID.|
@@ -128,11 +135,13 @@ This is a system API.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Description |
| -------- | ------ | ----- |
| language | string | Language ID.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
@@ -143,7 +152,7 @@ This is a system API.
```
-## i18n.getSystemLanguages
+## i18n.getSystemLanguages9+
getSystemLanguages(): Array<string>
@@ -154,6 +163,7 @@ Obtains the list of system languages.
**System API**: This is a system API and cannot be called by third-party applications.
**Return value**
+
| Type | Description |
| ------------------- | ------------ |
| Array<string> | List of the IDs of system languages.|
@@ -164,7 +174,7 @@ Obtains the list of system languages.
```
-## i18n.getSystemCountries
+## i18n.getSystemCountries9+
getSystemCountries(language: string): Array<string>
@@ -175,11 +185,13 @@ Obtains the list of countries and regions supported for the specified language.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
+
| Name | Type | Description |
| -------- | ------ | ----- |
| language | string | Language ID.|
**Return value**
+
| Type | Description |
| ------------------- | ------------ |
| Array<string> | List of the IDs of the countries and regions supported for the specified language.|
@@ -199,6 +211,7 @@ Obtains the system region.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------- |
| string | System region ID.|
@@ -222,11 +235,13 @@ This is a system API.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Description |
| ------ | ------ | ----- |
| region | string | Region ID.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
@@ -246,6 +261,7 @@ Obtains the system locale.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------- |
| string | System locale ID.|
@@ -269,11 +285,13 @@ This is a system API.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Description |
| ------ | ------ | --------------- |
| locale | string | System locale ID, for example, **zh-CN**.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
@@ -284,7 +302,7 @@ This is a system API.
```
-## i18n.isSuggested
+## i18n.isSuggested9+
isSuggested(language: string, region?: string): boolean
@@ -295,12 +313,14 @@ Checks whether the system language matches the specified region.
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
+
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ------------- |
| language | string | Yes | Valid language ID, for example, **zh**.|
| region | string | No | Valid region ID, for example, **CN**. |
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the system language matches the specified region; returns **false** otherwise.|
@@ -320,12 +340,14 @@ Obtains a **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. |
| type | string | No | Valid calendar type. Currently, the valid types are as follows: **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic\_civil**, **islamic\_tbla**, **islamic\_umalqura**, **japanese**, and **persian**. If this parameter is left unspecified, the default calendar type of the specified locale is used.|
**Return value**
+
| Type | Description |
| ---------------------- | ----- |
| [Calendar](#calendar8) | **Calendar** object.|
@@ -348,6 +370,7 @@ Sets the date for this **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ----------------- |
| date | Date | Yes | Date to be set for the **Calendar** object.|
@@ -369,6 +392,7 @@ Sets the date and time for this **Calendar** object. The value is represented by
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ---------------------------------------- |
| time | number | Yes | Number of milliseconds that have elapsed since the Unix epoch.|
@@ -389,6 +413,7 @@ Sets the year, month, day, hour, minute, and second for this **Calendar** object
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------ |
| year | number | Yes | Year to set. |
@@ -414,6 +439,7 @@ Sets the time zone of this **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ------------------------- |
| timezone | string | Yes | Time zone, for example, **Asia/Shanghai**.|
@@ -434,6 +460,7 @@ Obtains the time zone of this **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ---------- |
| string | Time zone of the **Calendar** object.|
@@ -455,6 +482,7 @@ Obtains the start day of a week for this **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | --------------------- |
| number | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
@@ -475,6 +503,7 @@ Sets the start day of a week for this **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | --------------------- |
| value | number | No | Start day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.|
@@ -495,6 +524,7 @@ Obtains the minimum number of days in the first week of a year.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------------ |
| number | Minimum number of days in the first week of a year.|
@@ -515,6 +545,7 @@ Sets the minimum number of days in the first week of a year.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ------------ |
| value | number | No | Minimum number of days in the first week of a year.|
@@ -535,11 +566,13 @@ Obtains the value of the specified field in the **Calendar** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| field | string | Yes | Value of the specified field in the **Calendar** object. Currently, a valid field can be any of the following: **era**, **year**, **month**, **week\_of\_year**, **week\_of\_month**, **date**, **day\_of\_year**, **day\_of\_week**, **day\_of\_week\_in\_month**, **hour**, **hour\_of\_day**, **minute**, **second**, **millisecond**, **zone\_offset**, **dst\_offset**, **year\_woy**, **dow\_local**, **extended\_year**, **julian\_day**, **milliseconds\_in\_day**, **is\_leap\_month**.|
**Return value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**.|
@@ -561,11 +594,13 @@ Obtains the name of the **Calendar** object displayed for the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| locale | string | Yes | Locale for which the name of the **Calendar** object is displayed. For example, if **locale** is **en-US**, the name of the Buddhist calendar will be **Buddhist Calendar**.|
**Return value**
+
| Type | Description |
| ------ | ------------------- |
| string | Name of the **Calendar** object displayed for the specified locale.|
@@ -586,11 +621,13 @@ Checks whether the specified date in this **Calendar** object is a weekend.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ---------------------------------------- |
| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend.|
**Return value**
+
| Type | Description |
| ------- | ----------------------------------- |
| boolean | Returns **true** if the date is a weekend; returns **false** if the date is a weekday.|
@@ -620,7 +657,7 @@ Parameters
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------- |
| country | string | Yes | Country or region to which the phone number to be formatted belongs.|
-| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. |
+| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | No | Options of the **PhoneNumberFormat** object. |
**Example**
```js
@@ -637,11 +674,13 @@ Checks whether the format of the specified phone number is valid.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | --------- |
| number | string | Yes | Phone number to be checked.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------------- |
| boolean | Returns **true** if the phone number format is valid; returns **false** otherwise.|
@@ -662,11 +701,13 @@ Formats a phone number.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------- |
| number | string | Yes | Phone number to be formatted.|
**Return value**
+
| Type | Description |
| ------ | ---------- |
| string | Formatted phone number.|
@@ -686,12 +727,14 @@ Obtains the home location of a phone number.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------- |
| number | string | Yes | Phone number.|
| locale | string | Yes | Locale ID.|
**Return value**
+
| Type | Description |
| ------ | ---------- |
| string | Home location of the phone number.|
@@ -703,7 +746,7 @@ Obtains the home location of a phone number.
```
-## PhoneNumberFormatOptions8+
+## PhoneNumberFormatOptions9+
Defines the options for this PhoneNumberFormat object.
@@ -726,18 +769,24 @@ Defines the measurement unit information.
| measureSystem | string | Yes | Yes | Measurement system. The value can be **SI**, **US**, or **UK**.|
-## Util8+
+## Util(deprecated)
-### unitConvert8+
+### unitConvert(deprecated)
static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string
Converts one measurement unit into another and formats the unit based on the specified locale and style.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [unitConvert](#unitconvert9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ---------------------------------------- |
| fromUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted. |
@@ -747,37 +796,10 @@ Converts one measurement unit into another and formats the unit based on the spe
| style | string | No | Style used for formatting. The value can be **long**, **short**, or **narrow**.|
**Return value**
-| Type | Description |
-| ------ | ----------------------- |
-| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.|
-
-**Example**
- ```js
- i18n.Util.unitConvert({unit: "cup", measureSystem: "US"}, {unit: "liter", measureSystem: "SI"}, 1000, "en-US", "long");
- ```
-
-### getDateOrder9+
-
-static getDateOrder(locale: string): string
-Obtains the sequence of the year, month, and day in the specified locale.
-
-**System capability**: SystemCapability.Global.I18n
-
-**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------- | ---- | ---------------------------------------- |
-| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. |
-
-**Return value**
| Type | Description |
| ------ | ----------------------- |
-| string | Sequence of the year, month, and day.|
-
-**Example**
- ```
- i18n.Util.getDateOrder("zh-CN");
- ```
+| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.|
## getInstance8+
@@ -789,11 +811,13 @@ Creates an **IndexUtil** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------- |
| locale | string | No | A string containing locale information, including the language, optional script, and region.|
**Return value**
+
| Type | Description |
| ------------------------ | --------------------- |
| [IndexUtil](#indexutil8) | **IndexUtil** object mapping to the specified locale.|
@@ -816,6 +840,7 @@ Obtains the index list for this **locale** object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------------------- | ------------------ |
| Array<string> | Index list for this **locale** object.|
@@ -836,6 +861,7 @@ Adds the index of the new **locale** object to the index list.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
@@ -856,11 +882,13 @@ Obtains the index of a text object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| text | string | Yes | **text** object whose index is to be obtained.|
**Return value**
+
| Type | Description |
| ------ | ----------- |
| string | Index of the **text** object.|
@@ -872,223 +900,250 @@ Obtains the index of a text object.
```
-## Character8+
+## Character(deprecated)
-### isDigit8+
+### isDigit(deprecated)
static isDigit(char: string): boolean
Checks whether the input character string is composed of digits.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isDigit](#isdigit9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------------ |
| boolean | Returns **true** if the input character is a digit; returns **false** otherwise.|
-**Example**
- ```js
- var isdigit = i18n.Character.isDigit("1"); // Return true.
- ```
-### isSpaceChar8+
+### isSpaceChar(deprecated)
static isSpaceChar(char: string): boolean
Checks whether the input character is a space.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isSpaceChar](#isspacechar9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | -------------------------------------- |
| boolean | Returns **true** if the input character is a space; returns **false** otherwise.|
-**Example**
- ```js
- var isspacechar = i18n.Character.isSpaceChar("a"); // Return false.
- ```
-### isWhitespace8+
+### isWhitespace(deprecated)
static isWhitespace(char: string): boolean
Checks whether the input character is a white space.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isWhitespace](#iswhitespace9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | -------------------------------------- |
| boolean | Returns **true** if the input character is a white space; returns **false** otherwise.|
-**Example**
- ```js
- var isspacechar = i18n.Character.isSpaceChar("a"); // Return false.
- ```
-### isRTL8+
+### isRTL(deprecated)
static isRTL(char: string): boolean
Checks whether the input character is of the right to left (RTL) language.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isRTL](#isrtl9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise.|
-**Example**
- ```js
- var isrtl = i18n.Character.isRTL("a"); // Return false.
- ```
-### isIdeograph8+
+### isIdeograph(deprecated)
static isIdeograph(char: string): boolean
Checks whether the input character is an ideographic character.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isIdeograph](#isideograph9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise.|
-**Example**
- ```js
- var isideograph = i18n.Character.isIdeograph("a"); // Return false.
- ```
-### isLetter8+
+### isLetter(deprecated)
static isLetter(char: string): boolean
Checks whether the input character is a letter.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isLetter](#isletter9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------------ |
| boolean | Returns **true** if the input character is a letter; returns **false** otherwise.|
-**Example**
- ```js
- var isletter = i18n.Character.isLetter("a"); // Return true.
- ```
-### isLowerCase8+
+### isLowerCase(deprecated)
static isLowerCase(char: string): boolean
Checks whether the input character is a lowercase letter.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isLowerCase](#islowercase9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise.|
-**Example**
- ```js
- var islowercase = i18n.Character.isLowerCase("a"); // Return true.
- ```
-### isUpperCase8+
+### isUpperCase(deprecated)
static isUpperCase(char: string): boolean
Checks whether the input character is an uppercase letter.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [isUpperCase](#isuppercase9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise.|
-**Example**
- ```js
- var isuppercase = i18n.Character.isUpperCase("a"); // Return false.
- ```
-### getType8+
+### getType(deprecated)
static getType(char: string): string
Obtains the type of the input character string.
+> **NOTE**
+> This API is deprecated since API version 9. You are advised to use [getType](#gettype9) instead.
+>
+> This API is supported since API version 8.
+
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----- |
| char | string | Yes | Input character.|
**Return value**
+
| Type | Description |
| ------ | ----------- |
| string | Type of the input character.|
-**Example**
- ```js
- var type = i18n.Character.getType("a");
- ```
## i18n.getLineInstance8+
@@ -1100,11 +1155,13 @@ Obtains a [BreakIterator](#breakiterator8) object for text segmentation.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| locale | string | Yes | Valid locale value, for example, **zh-Hans-CN**. The [BreakIterator](#breakiterator8) object segments text according to the rules of the specified locale.|
**Return value**
+
| Type | Description |
| -------------------------------- | ----------- |
| [BreakIterator](#breakiterator8) | [BreakIterator](#breakiterator8) object used for text segmentation.|
@@ -1127,6 +1184,7 @@ Sets the text to be processed by the [BreakIterator](#breakiterator8) object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----------------------- |
| text | string | Yes | Text to be processed by the **BreakIterator** object.|
@@ -1147,6 +1205,7 @@ Obtains the text being processed by the [BreakIterator](#breakiterator8) object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ---------------------- |
| string | Text being processed by the **BreakIterator** object.|
@@ -1168,6 +1227,7 @@ Obtains the position of the [BreakIterator](#breakiterator8) object in the text
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | --------------------------- |
| number | Position of the **BreakIterator** object in the text being processed.|
@@ -1189,6 +1249,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ----------------- |
| number | Offset to the first text boundary of the processed text.|
@@ -1210,6 +1271,7 @@ Puts the [BreakIterator](#breakiterator8) object to the last text boundary, whic
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------------------ |
| number | Offset of the last text boundary of the processed text.|
@@ -1231,11 +1293,13 @@ Moves the [BreakIterator](#breakiterator8) object backward by the specified numb
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| index | number | No | Number of text boundaries by which the [BreakIterator](#breakiterator8) object is moved. A positive value indicates that the text boundary is moved backward, and a negative value indicates the opposite. If no index is specified, the index will be treated as **1**.|
**Return value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved by the specified number of text boundaries. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.|
@@ -1259,6 +1323,7 @@ Moves the [BreakIterator](#breakiterator8) object to the previous text boundary.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| number | Position of the [BreakIterator](#breakiterator8) object in the text after it is moved to the previous text boundary. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of text boundaries.|
@@ -1282,11 +1347,13 @@ Moves the [BreakIterator](#breakiterator8) object to the text boundary after the
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------- |
| offset | number | Yes | Offset to the position before the text boundary to which the [BreakIterator](#breakiterator8) object is moved.|
**Return value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| number | The value **-1** is returned if the text boundary to which the [BreakIterator](#breakiterator8) object is moved is outside of the processed text.|
@@ -1310,11 +1377,13 @@ Checks whether the position specified by the offset is a text boundary. If **tru
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----------- |
| offset | number | Yes | Position to check.|
**Return value**
+
| Type | Description |
| ------- | ------------------------------- |
| boolean | Returns **true** if the position specified by the offset is a text boundary; returns **false** otherwise.|
@@ -1337,6 +1406,7 @@ Checks whether the 24-hour clock is used.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------- | ---------------------------------------- |
| boolean | Returns **true** if the 24-hour clock is used; returns **false** otherwise.|
@@ -1358,11 +1428,13 @@ Sets the 24-hour clock.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | ---------------------------------------- |
| option | boolean | Yes | Whether to enable the 24-hour clock. The value **true** means to enable the 24-hour clock, and the value **false** means the opposite.|
**Return value**
+
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the 24-hour clock is enabled; returns **false** otherwise.|
@@ -1385,12 +1457,14 @@ Adds a preferred language to the specified position on the preferred language li
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ---------- |
| language | string | Yes | Preferred language to add. |
| index | number | No | Position to which the preferred language is added.|
**Return value**
+
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the preferred language is successfully added; returns **false** otherwise.|
@@ -1415,11 +1489,13 @@ Deletes a preferred language from the specified position on the preferred langua
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | --------------------- |
| index | number | Yes | Position of the preferred language to delete.|
**Return value**
+
| Type | Description |
| ------- | ----------------------------- |
| boolean | Returns **true** if the preferred language is deleted; returns **false** otherwise.|
@@ -1441,6 +1517,7 @@ Obtains the list of preferred languages.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------------------- | --------- |
| Array<string> | List of preferred languages.|
@@ -1460,6 +1537,7 @@ Obtains the first language in the preferred language list.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | -------------- |
| string | First language in the preferred language list.|
@@ -1479,6 +1557,7 @@ Obtains the preferred language of an application.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | -------------- |
| string | Preferred language of the application.|
@@ -1498,11 +1577,13 @@ Obtains the **TimeZone** object corresponding to the specified time zone ID.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----- |
| zondID | string | No | Time zone ID.|
**Return value**
+
| Type | Description |
| -------- | ------------ |
| TimeZone | **TimeZone** object corresponding to the time zone ID.|
@@ -1525,6 +1606,7 @@ Obtains the ID of the specified **TimeZone** object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------------ |
| string | Time zone ID corresponding to the **TimeZone** object.|
@@ -1545,12 +1627,14 @@ Obtains the representation of a **TimeZone** object in the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------- |
| locale | string | No | System locale ID. |
| isDST | boolean | No | Whether to consider DST when obtaining the representation of the **TimeZone** object.|
**Return value**
+
| Type | Description |
| ------ | ------------- |
| string | Representation of the **TimeZone** object in the specified locale.|
@@ -1571,6 +1655,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone.|
@@ -1591,6 +1676,7 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ----------------------- |
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point.|
@@ -1610,6 +1696,7 @@ Obtains the list of time zone IDs supported by the system.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ----------------------- |
| Array<string> | List of time zone IDs supported by the system.|
@@ -1629,6 +1716,7 @@ Obtains the list of time zone city IDs supported by the system.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ----------------------- |
| Array<string> | List of time zone city IDs supported by the system.|
@@ -1648,12 +1736,14 @@ Obtains the localized display of a time zone city in the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----- |
| cityID | string | Yes | Time zone city ID.|
| locale | string | Yes | Locale ID.|
**Return value**
+
| Type | Description |
| ------ | ----------------------- |
| string | Localized display of the time zone city in the specified locale.|
@@ -1673,11 +1763,13 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----- |
| cityID | string | Yes | Time zone city ID.|
**Return value**
+
| Type | Description |
| ------ | ----------------------- |
| TimeZone | **TimeZone** object corresponding to the specified time zone city ID.|
@@ -1700,11 +1792,13 @@ This is a system API.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ----- |
| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite.|
**Return value**
+
| Type | Description |
| -------- | ------------ |
| boolean | Result indicating whether the local digit switch is successfully set. The value **true** indicates that the local digit switch is successfully set, and the value **false** indicates the opposite.|
@@ -1724,6 +1818,7 @@ Checks whether the local digit switch is turned on.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| -------- | ------------ |
| boolean | Result indicating whether the local digit switch is turned on. The value **true** indicates that the local digit switch is turned on, and the value **false** indicates the opposite.|
@@ -1745,6 +1840,7 @@ Obtains a list of IDs supported by the **Transliterator** object.
**System capability**: SystemCapability.Global.I18n
**Return value**
+
| Type | Description |
| ------ | ------------ |
| string[] | List of IDs supported by the **Transliterator** object.|
@@ -1764,11 +1860,13 @@ Creates a **Transliterator** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------- |
| id | string | Yes | ID supported by the **Transliterator** object. |
**Return value**
+
| Type | Description |
| ------ | ------------- |
| [Transliterator](#transliterator9) | **Transliterator** object.|
@@ -1788,11 +1886,13 @@ Converts the input string from the source format to the target format.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------- | ---- | -------------------- |
| text | string | Yes | Input string. |
**Return value**
+
| Type | Description |
| ------ | ------------- |
| string | Target string.|
@@ -1802,3 +1902,298 @@ Converts the input string from the source format to the target format.
var transliterator = i18n.Transliterator.getInstance("Any-Latn");
transliterator.transform ("China");
```
+
+## Unicode9+
+
+
+### isDigit9+
+
+static isDigit(char: string): boolean
+
+Checks whether the input character string is composed of digits.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ------------------------------------ |
+| boolean | Returns **true** if the input character is a digit; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isdigit = i18n.Unicode.isDigit("1"); // Return true.
+ ```
+
+
+### isSpaceChar9+
+
+static isSpaceChar(char: string): boolean
+
+Checks whether the input character is a space.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | -------------------------------------- |
+| boolean | Returns **true** if the input character is a space; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isspacechar = i18n.Unicode.isSpaceChar("a"); // Return false.
+ ```
+
+
+### isWhitespace9+
+
+static isWhitespace(char: string): boolean
+
+Checks whether the input character is a white space.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | -------------------------------------- |
+| boolean | Returns **true** if the input character is a white space; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var iswhitespace = i18n.Unicode.isWhitespace("a"); // Return false.
+ ```
+
+
+### isRTL9+
+
+static isRTL(char: string): boolean
+
+Checks whether the input character is of the right to left (RTL) language.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ---------------------------------------- |
+| boolean | Returns **true** if the input character is of the RTL language; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isrtl = i18n.Unicode.isRTL("a"); // Return false.
+ ```
+
+
+### isIdeograph9+
+
+static isIdeograph(char: string): boolean
+
+Checks whether the input character is an ideographic character.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ---------------------------------------- |
+| boolean | Returns **true** if the input character is an ideographic character; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isideograph = i18n.Unicode.isIdeograph("a"); // Return false.
+ ```
+
+
+### isLetter9+
+
+static isLetter(char: string): boolean
+
+Checks whether the input character is a letter.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ------------------------------------ |
+| boolean | Returns **true** if the input character is a letter; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isletter = i18n.Unicode.isLetter("a"); // Return true.
+ ```
+
+
+### isLowerCase9+
+
+static isLowerCase(char: string): boolean
+
+Checks whether the input character is a lowercase letter.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ---------------------------------------- |
+| boolean | Returns **true** if the input character is a lowercase letter; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var islowercase = i18n.Unicode.isLowerCase("a"); // Return true.
+ ```
+
+
+### isUpperCase9+
+
+static isUpperCase(char: string): boolean
+
+Checks whether the input character is an uppercase letter.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------- | ---------------------------------------- |
+| boolean | Returns **true** if the input character is an uppercase letter; returns **false** otherwise.|
+
+**Example**
+ ```js
+ var isuppercase = i18n.Unicode.isUpperCase("a"); // Return false.
+ ```
+
+
+### getType9+
+
+static getType(char: string): string
+
+Obtains the type of the input character string.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----- |
+| char | string | Yes | Input character.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ----------- |
+| string | Type of the input character.|
+
+**Example**
+ ```js
+ var type = i18n.Unicode.getType("a");
+ ```
+
+
+## I18NUtil9+
+
+
+### unitConvert9+
+
+static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string
+
+Converts one measurement unit into another and formats the unit based on the specified locale and style.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------- | ---- | ---------------------------------------- |
+| fromUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted. |
+| toUnit | [UnitInfo](#unitinfo8) | Yes | Measurement unit to be converted to. |
+| value | number | Yes | Value of the measurement unit to be converted. |
+| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**. |
+| style | string | No | Style used for formatting. The value can be **long**, **short**, or **narrow**.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ----------------------- |
+| string | Character string obtained after formatting based on the measurement unit specified by **toUnit**.|
+
+**Example**
+ ```js
+ i18n.I18NUtil.unitConvert({unit: "cup", measureSystem: "US"}, {unit: "liter", measureSystem: "SI"}, 1000, "en-US", "long");
+ ```
+
+
+### getDateOrder9+
+
+static getDateOrder(locale: string): string
+
+Obtains the sequence of the year, month, and day in the specified locale.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ------ | ------ | ---- | ------------------------- |
+| locale | string | Yes | Locale used for formatting, for example, **zh-Hans-CN**.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------- |
+| string | Sequence of the year, month, and day.|
+
+**Example**
+ ```js
+ i18n.I18NUtil.getDateOrder("zh-CN");
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-image.md b/en/application-dev/reference/apis/js-apis-image.md
index bcbf619bf7173a405eee37f5dac86c5e87a023e9..866a5833b69feb01da451f2464fbdd7915f06172 100644
--- a/en/application-dev/reference/apis/js-apis-image.md
+++ b/en/application-dev/reference/apis/js-apis-image.md
@@ -115,7 +115,7 @@ const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer).then(() => {
console.log('Succeeded in reading image pixel data.'); // Called if the condition is met.
}).catch(error => {
- ('Failed to read image pixel data.'); // Called if no condition is met.
+ console.log('Failed to read image pixel data.'); // Called if no condition is met.
})
```
@@ -261,12 +261,7 @@ image.createPixelMap(color, opts)
}
pixelmap.writePixels(area).then(() => {
- const readArea = { pixels: new ArrayBuffer(8),
- offset: 0,
- stride: 8,
- // region.size.width + x < opts.width, region.size.height + y < opts.height
- region: { size: { height: 1, width: 2 }, x: 0, y: 0 }
- }
+ console.info('Succeeded to write pixelmap into the specified area.');
})
}).catch(error => {
console.log('error: ' + error);
@@ -291,17 +286,20 @@ Writes image pixel map data to an area. This API uses an asynchronous callback t
**Example**
```js
-const area = new ArrayBuffer(400);
+const area = { pixels: new ArrayBuffer(8),
+ offset: 0,
+ stride: 8,
+ region: { size: { height: 1, width: 2 }, x: 0, y: 0 }
+}
+let bufferArr = new Uint8Array(area.pixels);
+for (var i = 0; i < bufferArr.length; i++) {
+ bufferArr[i] = i + 1;
+}
pixelmap.writePixels(area, (error) => {
if (error != undefined) {
console.info('Failed to write pixelmap into the specified area.');
} else {
- const readArea = {
- pixels: new ArrayBuffer(20),
- offset: 0,
- stride: 8,
- region: { size: { height: 1, width: 2 }, x: 0, y: 0 },
- }
+ console.info('Succeeded to write pixelmap into the specified area.');
}
})
```
@@ -330,9 +328,11 @@ Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** obj
```js
const color = new ArrayBuffer(96);
-const pixelMap = new ArrayBuffer(400);
let bufferArr = new Uint8Array(color);
-pixelMap.writeBufferToPixels(color).then(() => {
+for (var i = 0; i < bufferArr.length; i++) {
+ bufferArr[i] = i + 1;
+}
+pixelmap.writeBufferToPixels(color).then(() => {
console.log("Succeeded in writing data from a buffer to a PixelMap.");
}).catch((err) => {
console.error("Failed to write data from a buffer to a PixelMap.");
@@ -358,9 +358,11 @@ Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** obj
```js
const color = new ArrayBuffer(96);
-const pixelMap = new ArrayBuffer(400);
let bufferArr = new Uint8Array(color);
-pixelMap.writeBufferToPixels(color, function(err) {
+for (var i = 0; i < bufferArr.length; i++) {
+ bufferArr[i] = i + 1;
+}
+pixelmap.writeBufferToPixels(color, function(err) {
if (err) {
console.error("Failed to write data from a buffer to a PixelMap.");
return;
@@ -387,12 +389,22 @@ Obtains pixel map information of this image. This API uses a promise to return t
**Example**
```js
-const pixelMap = new ArrayBuffer(400);
-pixelMap.getImageInfo().then(function(info) {
- console.log("Succeeded in obtaining the image pixel map information.");
-}).catch((err) => {
- console.error("Failed to obtain the image pixel map information.");
-});
+const color = new ArrayBuffer(96);
+let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } }
+image.createPixelMap(color, opts).then(pixelmap => {
+ globalpixelmap = pixelmap;
+ if (pixelmap == undefined) {
+ console.error("Failed to obtain the image pixel map information.");
+ }
+ pixelmap.getImageInfo().then(imageInfo => {
+ if (imageInfo == undefined) {
+ console.error("Failed to obtain the image pixel map information.");
+ }
+ if (imageInfo.size.height == 4 && imageInfo.size.width == 6) {
+ console.log("Succeeded in obtaining the image pixel map information.");
+ }
+ })
+})
```
### getImageInfo7+
@@ -412,8 +424,21 @@ Obtains pixel map information of this image. This API uses an asynchronous callb
**Example**
```js
-pixelmap.getImageInfo((imageInfo) => {
- console.log("Succeeded in obtaining the image pixel map information.");
+const color = new ArrayBuffer(96);
+let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
+image.createPixelMap(color, opts, (err, pixelmap) => {
+ if (pixelmap == undefined) {
+ globalpixelmap = pixelmap;
+ console.error("Failed to obtain the image pixel map information.");
+ }
+ pixelmap.getImageInfo((err, imageInfo) => {
+ if (imageInfo == undefined) {
+ console.error("Failed to obtain the image pixel map information.");
+ }
+ if (imageInfo.size.height == 4 && imageInfo.size.width == 6) {
+ console.log("Succeeded in obtaining the image pixel map information.");
+ }
+ })
})
```
@@ -500,9 +525,15 @@ Sets an opacity rate for this image pixel map. This API uses an asynchronous cal
**Example**
```js
-async function () {
- await pixelMap.opacity(0.5);
-}
+var rate = 0.5;
+pixelmap.opacity(rate, (err) => {
+ if (err) {
+ console.error("Failed to set opacity.");
+ return;
+ } else {
+ console.log("Succeeded in setting opacity.");
+ }
+})
```
### opacity9+
@@ -529,7 +560,8 @@ Sets an opacity rate for this image pixel map. This API uses a promise to return
```js
async function () {
- await pixelMap.opacity(0.5);
+ var rate = 0.5;
+ await pixelmap.opacity(rate);
}
```
@@ -550,12 +582,8 @@ Creates a **PixelMap** object that contains only the alpha channel information.
**Example**
```js
-pixelMap.createAlphaPixelmap(async (err, alphaPixelMap) => {
- if (alphaPixelMap == undefined) {
- console.info('Failed to obtain new pixel map.');
- } else {
- console.info('Succeed in obtaining new pixel map.');
- }
+async function () {
+ await pixelmap.createAlphaPixelmap();
})
```
@@ -576,14 +604,13 @@ Creates a **PixelMap** object that contains only the alpha channel information.
**Example**
```js
-let pixelMap = await imageSource.createPixelMap();
-if (pixelMap != undefined) {
- pixelMap.createAlphaPixelmap(async (err, alphaPixelMap) => {
- console.info('Failed to obtain new pixel map.');
- })
-} else {
- console.info('Succeed in obtaining new pixel map.');
-}
+pixelmap.createAlphaPixelmap((err, alphaPixelMap) => {
+ if (alphaPixelMap == undefined) {
+ console.info('Failed to obtain new pixel map.');
+ } else {
+ console.info('Succeed in obtaining new pixel map.');
+ }
+})
```
### scale9+
@@ -606,7 +633,7 @@ Scales this image based on the input width and height. This API uses an asynchro
```js
async function () {
- await pixelMap.scale(2.0, 1.0);
+ await pixelmap.scale(2.0, 1.0);
}
```
@@ -635,7 +662,7 @@ Scales this image based on the input width and height. This API uses a promise t
```js
async function () {
- await pixelMap.scale(2.0, 1.0);
+ await pixelmap.scale(2.0, 1.0);
}
```
@@ -659,7 +686,7 @@ Translates this image based on the input coordinates. This API uses an asynchron
```js
async function () {
- await pixelMap.translate(3.0, 1.0);
+ await pixelmap.translate(3.0, 1.0);
}
```
@@ -688,7 +715,7 @@ Translates this image based on the input coordinates. This API uses a promise to
```js
async function () {
- await pixelMap.translate(3.0, 1.0);
+ await pixelmap.translate(3.0, 1.0);
}
```
@@ -711,7 +738,7 @@ Rotates this image based on the input angle. This API uses an asynchronous callb
```js
async function () {
- await pixelMap.rotate(90.0);
+ await pixelmap.rotate(90.0);
}
```
@@ -739,7 +766,7 @@ Rotates this image based on the input angle. This API uses a promise to return t
```js
async function () {
- await pixelMap.rotate(90.0);
+ await pixelmap.rotate(90.0);
}
```
@@ -763,7 +790,7 @@ Flips this image horizontally or vertically, or both. This API uses an asynchron
```js
async function () {
- await pixelMap.flip(false, true);
+ await pixelmap.flip(false, true);
}
```
@@ -792,7 +819,7 @@ Flips this image horizontally or vertically, or both. This API uses a promise to
```js
async function () {
- await pixelMap.flip(false, true);
+ await pixelmap.flip(false, true);
}
```
@@ -815,7 +842,7 @@ Crops this image based on the input size. This API uses an asynchronous callback
```js
async function () {
- await pixelMap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
+ await pixelmap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
}
```
@@ -843,7 +870,7 @@ Crops this image based on the input size. This API uses a promise to return the
```js
async function () {
- await pixelMap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
+ await pixelmap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
}
```
@@ -954,7 +981,8 @@ Creates an **ImageSource** instance based on the URI.
**Example**
```js
-const imageSourceApi = image.createImageSource('/sdcard/test.jpg');
+var sourceOptions = { sourceDensity: 120 };
+let imageSource = image.createImageSource('test.png', sourceOptions);
```
## image.createImageSource7+
@@ -1007,7 +1035,8 @@ Creates an **ImageSource** instance based on the file descriptor.
**Example**
```js
-const imageSourceApi = image.createImageSource(fd);
+var sourceOptions = { sourceDensity: 120 };
+const imageSourceApi = image.createImageSource(0, sourceOptions);
```
## image.createImageSource9+
@@ -1059,9 +1088,9 @@ const data = new ArrayBuffer(112);
const imageSourceApi = image.createImageSource(data);
```
-## image.CreateIncrementalSource9+
+## image.createIncrementalSource9+
-CreateIncrementalSource(buf: ArrayBuffer): ImageSource
+createIncrementalSource(buf: ArrayBuffer): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffers.
@@ -1083,12 +1112,12 @@ Creates an **ImageSource** instance in incremental mode based on the buffers.
```js
const buf = new ArrayBuffer(96);
-const imageSourceApi = image.CreateIncrementalSource(buf);
+const imageSourceIncrementalSApi = image.createIncrementalSource(buf);
```
-## image.CreateIncrementalSource9+
+## image.createIncrementalSource9+
-CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
+createIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffers.
@@ -1111,7 +1140,7 @@ Creates an **ImageSource** instance in incremental mode based on the buffers.
```js
const buf = new ArrayBuffer(96);
-const imageSourceApi = image.CreateIncrementalSource(buf);
+const imageSourceIncrementalSApi = image.createIncrementalSource(buf);
```
## ImageSource
@@ -1124,7 +1153,7 @@ Provides APIs to obtain image information. Before calling any API in **ImageSour
| Name | Type | Readable| Writable| Description |
| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
-| supportedFormats | Array\ | Yes | No | Supported image formats, including png, jpeg, wbmp, bmp, gif, webp, and heif.|
+| supportedFormats | Array\ | Yes | No | Supported image formats, including PNG, JPEG, BMP, GIF, WebP, and RAW.|
### getImageInfo
@@ -1282,7 +1311,7 @@ Obtains the value of a property in this image. This API uses an asynchronous cal
**Example**
```js
-const property = new ArrayBuffer(400);
+let property = { index: 0, defaultValue: '9999' }
imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => {
if(error) {
console.log('Failed to get the value of the specified attribute key of the image.');
@@ -1477,7 +1506,15 @@ Creates a **PixelMap** object based on image decoding parameters. This API uses
**Example**
```js
-const decodingOptions = new ArrayBuffer(400);
+let decodingOptions = {
+ sampleSize: 1,
+ editable: true,
+ desiredSize: { width: 1, height: 2 },
+ rotate: 10,
+ desiredPixelFormat: 3,
+ desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
+ index: 0
+};
imageSourceApi.createPixelMap(decodingOptions, pixelmap => {
console.log('Succeeded in creating pixelmap object.');
})
@@ -1551,7 +1588,7 @@ const imagePackerApi = image.createImagePacker();
## ImagePacker
-Provide APIs to pack images. Before calling any API in **ImagePacker**, you must use **createImagePacker** to create an **ImagePacker** instance.
+Provides APIs to pack images. Before calling any API in **ImagePacker**, you must use **createImagePacker** to create an **ImagePacker** instance. The image formats JPEG and WebP are supported.
### Attributes
@@ -1581,7 +1618,6 @@ Packs an image. This API uses an asynchronous callback to return the result.
```js
let packOpts = { format:"image/jpeg", quality:98 };
-const imageSourceApi = new ArrayBuffer(400);
imagePackerApi.packing(imageSourceApi, packOpts, data => {})
```
@@ -1610,7 +1646,6 @@ Packs an image. This API uses a promise to return the result.
```js
let packOpts = { format:"image/jpeg", quality:98 }
-const imageSourceApi = new ArrayBuffer(400);
imagePackerApi.packing(imageSourceApi, packOpts)
.then( data => {
console.log('packing succeeded.');
@@ -2112,7 +2147,7 @@ Describes area information in an image.
| ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ |
| pixels | ArrayBuffer | Yes | No | Pixels of the image. |
| offset | number | Yes | No | Offset for data reading. |
-| stride | number | Yes | No | Number of bytes from one row of pixels in memory to the next row of pixels in memory. The value of **stride** must be greater than or equal to the value of **region.size.width** multiplied by 4. |
+| stride | number | Yes | No | Number of bytes from one row of pixels in memory to the next row of pixels in memory. The value of **stride** must be greater than or equal to the value of **region.size.width** multiplied by 4. |
| region | [Region](#region7) | Yes | No | Region to read or write. The width of the region to write plus the X coordinate cannot be greater than the width of the original image. The height of the region to write plus the Y coordinate cannot be greater than the height of the original image.|
## ImageInfo
@@ -2146,8 +2181,8 @@ Enumerates the pixel formats of images.
| ---------------------- | ------ | ----------------- |
| UNKNOWN | 0 | Unknown format. |
| RGB_565 | 2 | RGB_565. |
-| RGBA_8888 | 3 | RGBA_8888.|
-| BGRA_88889+ | 4 | BGRA_8888.|
+| RGBA_8888 | 3 | RGBA_8888. |
+| BGRA_88889+ | 4 | BGRA_8888. |
## AlphaType9+
@@ -2159,8 +2194,8 @@ Enumerates the alpha types of images.
| -------- | ------ | ----------------------- |
| UNKNOWN | 0 | Unknown alpha type. |
| OPAQUE | 1 | There is no alpha or the image is opaque.|
-| PREMUL | 2 | Premultiplied alpha. |
-| UNPREMUL | 3 | Unpremultiplied alpha, that is, straight alpha. |
+| PREMUL | 2 | Premultiplied alpha. |
+| UNPREMUL | 3 | Unpremultiplied alpha, that is, straight alpha. |
## ScaleMode9+
@@ -2236,7 +2271,7 @@ Defines the option for image packing.
| Name | Type | Readable| Writable| Description |
| ------- | ------ | ---- | ---- | --------------------------------------------------- |
-| format | string | Yes | Yes | Format of the packed image. Currently, the following raw formats are supported: .jpg, .png, .gif, .bmp, and .webp. |
+| format | string | Yes | Yes | Format of the packed image. Currently, the JPEG and WebP formats are supported. |
| quality | number | Yes | Yes | Quality of the output image during JPEG encoding. The value ranges from 1 to 100.|
## GetImagePropertyOptions7+
diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md
index cae08502ee91872765050fbb53fe6701bc2cbb9b..fcf2858aa7b4a1adda999a0e1bf0850495c0d00f 100644
--- a/en/application-dev/reference/apis/js-apis-intl.md
+++ b/en/application-dev/reference/apis/js-apis-intl.md
@@ -60,6 +60,7 @@ Creates a Locale object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------- | ------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
@@ -80,6 +81,7 @@ Converts locale information to a string.
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ------ | ----------- |
| string | String containing locale information.|
@@ -100,6 +102,7 @@ Maximizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the maximized information.|
@@ -120,6 +123,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the minimized information.|
@@ -131,7 +135,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
```
-## LocaleOptions
+## LocaleOptions9+
Represents the locale options.
@@ -173,6 +177,7 @@ Creates a **DateTimeOptions** object for the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
@@ -199,11 +204,13 @@ Formats the specified date and time.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ------- |
| date | Date | Yes | Date and time to be formatted.|
**Return Value**
+
| Type | Description |
| ------ | ------------ |
| string | A string containing the formatted date and time.|
@@ -225,12 +232,14 @@ Formats the specified date range.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| --------- | ---- | ---- | -------- |
| startDate | Date | Yes | Start date and time to be formatted.|
| endDate | Date | Yes | End date and time to be formatted.|
**Return Value**
+
| Type | Description |
| ------ | -------------- |
| string | A string containing the formatted date and time range.|
@@ -253,6 +262,7 @@ Obtains the formatting options for **DateTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ----------------------------------- | ----------------------------- |
| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects.|
@@ -264,7 +274,7 @@ Obtains the formatting options for **DateTimeFormat** object.
```
-## DateTimeOptions
+## DateTimeOptions9+
Provides the options for the **DateTimeFormat** object.
@@ -339,11 +349,13 @@ Formats a number.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---- |
| number | number | Yes | Number to be formatted.|
**Return Value**
+
| Type | Description |
| ------ | ---------- |
| string | Formatted number.|
@@ -365,6 +377,7 @@ Obtains the options of the **NumberFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects.|
@@ -377,7 +390,7 @@ Obtains the options of the **NumberFormat** object.
```
-## NumberOptions
+## NumberOptions9+
Provides the device capability.
@@ -453,12 +466,14 @@ Compares two strings based on the sorting policy of the **Collator** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------------ |
| first | string | Yes | First string to compare. |
| second | string | Yes | Second string to compare.|
**Return Value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string.|
@@ -479,6 +494,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ----------------------------------- | ----------------- |
| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object.|
@@ -490,7 +506,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
```
-## CollatorOptions8+
+## CollatorOptions9+
Represents the properties of a **Collator** object.
@@ -553,11 +569,13 @@ Obtains a string that represents the singular-plural type of the specified numbe
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| n | number | Yes | Number for which the singular-plural type is to be obtained.|
**Return Value**
+
| Type | Description |
| ------ | ---------------------------------------- |
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.|
@@ -569,7 +587,7 @@ Obtains a string that represents the singular-plural type of the specified numbe
```
-## PluralRulesOptions8+
+## PluralRulesOptions9+
Represents the properties of a **PluralRules** object.
@@ -611,7 +629,8 @@ Creates a **RelativeTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
-Parameters
+**Parameters**
+
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
@@ -632,12 +651,14 @@ Formats the value and unit based on the specified locale and formatting options.
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
+
| Type | Description |
| ------ | ---------- |
| string | Relative time after formatting.|
@@ -658,12 +679,14 @@ Returns an array of RelativeTimeFormat objects in parts for locale-aware formatt
**System capability**: SystemCapability.Global.I18n
**Parameters**
+
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
+
| Type | Description |
| ------------------- | --------------------------- |
| Array<object> | An array of **RelativeTimeFormat** objects in parts.|
@@ -684,6 +707,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
**System capability**: SystemCapability.Global.I18n
**Return Value**
+
| Type | Description |
| ---------------------------------------- | --------------------------------- |
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects.|
@@ -695,7 +719,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
```
-## RelativeTimeFormatInputOptions8+
+## RelativeTimeFormatInputOptions9+
Represents the properties of a **RelativeTimeFormat** object.
diff --git a/en/application-dev/reference/apis/js-apis-lightweightmap.md b/en/application-dev/reference/apis/js-apis-lightweightmap.md
index 5ac480761ba58f22e2f120aeaa0aca58faed366d..4ff765d9cf8cefcbd3682d7cd9dbd216400d21cb 100644
--- a/en/application-dev/reference/apis/js-apis-lightweightmap.md
+++ b/en/application-dev/reference/apis/js-apis-lightweightmap.md
@@ -12,6 +12,10 @@ Compared with **[HashMap](js-apis-hashmap.md)**, which can also store KV pairs,
**Recommended use case**: Use LightWeightMap when you need to store and access **KV pairs**.
+This topic uses the following to identify the use of generics:
+- K: Key
+- V: Value
+
## Modules to Import
```ts
@@ -92,10 +96,10 @@ Checks whether this container contains all elements of the specified **LightWeig
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let map = new LightWeightMap();
-map.set("sdfs", 356);
+map.set("sparrow", 356);
let result = lightWeightMap.hasAll(map);
```
@@ -125,9 +129,9 @@ Checks whether this container contains the specified key.
```ts
let lightWeightMap = new LightWeightMap();
let result = lightWeightMap.hasKey;
-lightWeightMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-let result1 = lightWeightMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+lightWeightMap.hasKey("squirrel");
+lightWeightMap.set("squirrel", 123);
+let result1 = lightWeightMap.hasKey("squirrel");
```
@@ -156,7 +160,7 @@ Checks whether this container contains the specified value.
```ts
let lightWeightMap = new LightWeightMap();
let result = lightWeightMap.hasValue(123);
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+lightWeightMap.set("squirrel", 123);
let result1 = lightWeightMap.hasValue(123);
```
@@ -207,9 +211,9 @@ Obtains the value of the specified key in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
-let result = lightWeightMap.get("sdfs");
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
+let result = lightWeightMap.get("sparrow");
```
@@ -237,9 +241,9 @@ Obtains the index of the first occurrence of an element with the specified key i
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
-let result = lightWeightMap.getIndexOfKey("sdfs");
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
+let result = lightWeightMap.getIndexOfKey("sparrow");
```
@@ -267,8 +271,8 @@ Obtains the index of the first occurrence of an element with the specified value
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getIndexOfValue(123);
```
@@ -297,8 +301,8 @@ Obtains the key of an element at the specified position in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getKeyAt(1);
```
@@ -321,8 +325,8 @@ Adds all elements in a **LightWeightMap** instance to this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let map = new LightWeightMap();
lightWeightMap.setAll(map);
```
@@ -352,7 +356,7 @@ Adds an element to this container.
```ts
let lightWeightMap = new LightWeightMap();
-let result = lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+let result = lightWeightMap.set("squirrel", 123);
```
@@ -380,9 +384,9 @@ Removes an element with the specified key from this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
-lightWeightMap.remove("sdfs");
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
+lightWeightMap.remove("sparrow");
```
@@ -410,8 +414,8 @@ Removes an element at the specified position from this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.removeAt(1);
```
@@ -441,8 +445,8 @@ Sets a value for an element at the specified position in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
lightWeightMap.setValueAt(1, 3546);
```
@@ -471,8 +475,8 @@ Obtains the value of an element at the specified position in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let result = lightWeightMap.getValueAt(1);
```
@@ -489,8 +493,8 @@ Clears this container and sets its length to **0**.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
lightWeightMap.clear();
```
@@ -513,8 +517,8 @@ Obtains an iterator that contains all the keys in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.keys();
let temp = iter.next().value;
while(temp != undefined) {
@@ -542,8 +546,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.values();
let temp = iter.next().value;
while(temp != undefined) {
@@ -579,8 +583,8 @@ callbackfn
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("sdfs", 123);
-lightWeightMap.set("dfsghsf", 357);
+lightWeightMap.set("sparrow", 123);
+lightWeightMap.set("gull", 357);
lightWeightMap.forEach((value, key) => {
console.log("value:" + value, key);
});
@@ -605,8 +609,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.entries();
let temp = iter.next().value;
while(temp != undefined) {
@@ -634,8 +638,8 @@ Concatenates the elements in this container into a string and returns the string
```ts
let lightWeightMap = new LightWeightMap();
- lightWeightMap.set("A", 123);
- lightWeightMap.set("sdfs", 356);
+ lightWeightMap.set("squirrel", 123);
+ lightWeightMap.set("sparrow", 356);
let iter = lightWeightMap.toString();
```
@@ -657,8 +661,8 @@ Obtains an iterator, each item of which is a JavaScript object.
```ts
let lightWeightMap = new LightWeightMap();
-lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-lightWeightMap.set("sdfs", 356);
+lightWeightMap.set("squirrel", 123);
+lightWeightMap.set("sparrow", 356);
// Method 1:
for (let item of lightWeightMap) {
diff --git a/en/application-dev/reference/apis/js-apis-lightweightset.md b/en/application-dev/reference/apis/js-apis-lightweightset.md
index 4a900d9f5476216ae7e98a0df9d762119753ad36..d64a40d1b65854d3f97ba399c6426b94b9c71bf0 100644
--- a/en/application-dev/reference/apis/js-apis-lightweightset.md
+++ b/en/application-dev/reference/apis/js-apis-lightweightset.md
@@ -14,6 +14,9 @@ Compared with **[HashSet](js-apis-hashset.md)**, which can also store values, **
**Recommended use case**: Use **LightWeightSet** when you need a set that has only unique elements or need to deduplicate a set.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -93,7 +96,7 @@ Adds an element to this container.
```ts
let lightWeightSet = new LightWeightSet();
-let result = lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = lightWeightSet.add("squirrel");
```
@@ -115,10 +118,10 @@ Adds all elements in a **LightWeightSet** instance to this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let set = new LightWeightSet();
-set.add("sfage");
+set.add("gull");
let result = lightWeightSet.addAll(set);
```
@@ -147,10 +150,10 @@ Checks whether this container contains all elements of the specified **LightWeig
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let set = new LightWeightSet();
-set.add("sdfs");
+set.add("sparrow");
let result = lightWeightSet.hasAll(set);
```
@@ -209,9 +212,9 @@ Checks whether this container contains objects of the same type as the specified
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
-let obj = ["Ahfbrgrbgnutfodgorrogorgrogofdfdf", "sdfs"];
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
+let obj = ["squirrel", "sparrow"];
let result = lightWeightSet.equal(obj);
```
@@ -262,9 +265,9 @@ Obtains the position index of the element with the specified key in this contain
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
-let result = lightWeightSet.getIndexOf("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
+let result = lightWeightSet.getIndexOf("sparrow");
```
@@ -292,9 +295,9 @@ Removes an element of the specified key from this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
-let result = lightWeightSet.remove("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
+let result = lightWeightSet.remove("sparrow");
```
@@ -322,8 +325,8 @@ Removes the element at the specified position from this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let result = lightWeightSet.removeAt(1);
```
@@ -352,8 +355,8 @@ Obtains the value of the element at the specified position in this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let result = lightWeightSet.getValueAt(1);
```
@@ -370,8 +373,8 @@ Clears this container and sets its length to **0**.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
lightWeightSet.clear();
```
@@ -394,8 +397,8 @@ Obtains a string that contains all elements in this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let result = lightWeightSet.toString();
```
@@ -418,8 +421,8 @@ Obtains an array that contains all objects in this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let result = lightWeightSet.toArray();
```
@@ -442,8 +445,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let iter = lightWeightSet.values();
let index = 0;
while(index < lightWeightSet.length) {
@@ -479,8 +482,8 @@ callbackfn
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("sdfs");
-lightWeightSet.add("dfsghsf");
+lightWeightSet.add("sparrow");
+lightWeightSet.add("gull");
lightWeightSet.forEach((value, key) => {
console.log("value:" + value, key);
});
@@ -505,8 +508,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
let iter = lightWeightSet.entries();
let index = 0;
while(index < lightWeightSet.length) {
@@ -534,8 +537,8 @@ Obtains an iterator, each item of which is a JavaScript object.
```ts
let lightWeightSet = new LightWeightSet();
-lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-lightWeightSet.add("sdfs");
+lightWeightSet.add("squirrel");
+lightWeightSet.add("sparrow");
// Method 1:
for (let item of lightWeightSet) {
diff --git a/en/application-dev/reference/apis/js-apis-linkedlist.md b/en/application-dev/reference/apis/js-apis-linkedlist.md
index 73737f14b6078445e1f67762ca43a86a22804dbe..3265367a954c1ce027591bc056827717e889339b 100644
--- a/en/application-dev/reference/apis/js-apis-linkedlist.md
+++ b/en/application-dev/reference/apis/js-apis-linkedlist.md
@@ -12,6 +12,9 @@ Unlike **[List](js-apis-list.md)**, which is a singly linked list, **LinkedList*
**Recommended use case**: Use **LinkedList** for frequent insertion and removal operations.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -76,7 +79,7 @@ let result = linkedList.add("a");
let result1 = linkedList.add(1);
let b = [1, 2, 3];
linkedList.add(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
let result3 = linkedList.add(false);
```
@@ -102,7 +105,7 @@ linkedList.addFirst("a");
linkedList.addFirst(1);
let b = [1, 2, 3];
linkedList.addFirst(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
linkedList.addFirst(false);
```
@@ -154,9 +157,9 @@ Checks whether this container has the specified element.
```ts
let linkedList = new LinkedList();
-let result1 = linkedList.has("Ahfbrgrbgnutfodgorrogorg");
-linkedList.add("Ahfbrgrbgnutfodgorrogorg");
-let result = linkedList.has("Ahfbrgrbgnutfodgorrogorg");
+let result1 = linkedList.has("squirrel");
+linkedList.add("squirrel");
+let result = linkedList.has("squirrel");
```
### get
diff --git a/en/application-dev/reference/apis/js-apis-list.md b/en/application-dev/reference/apis/js-apis-list.md
index 0b839a5a0baae3fa58e4592485c3b9e959183530..4534668591a447df0a1f36d4f8ca3866a3e31692 100644
--- a/en/application-dev/reference/apis/js-apis-list.md
+++ b/en/application-dev/reference/apis/js-apis-list.md
@@ -10,6 +10,9 @@ Unlike [LinkedList](js-apis-linkedlist.md), which is a doubly linked list, **Lis
**Recommended use case**: Use **List** for frequent insertion and removal operations.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -72,7 +75,7 @@ let result = list.add("a");
let result1 = list.add(1);
let b = [1, 2, 3];
list.add(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
let result3 = list.add(false);
```
@@ -124,9 +127,9 @@ Checks whether this container has the specified element.
```ts
let list = new List();
-let result = list.has("Ahfbrgrbgnutfodgorrogorg");
-list.add("Ahfbrgrbgnutfodgorrogorg");
-let result1 = list.has("Ahfbrgrbgnutfodgorrogorg");
+let result = list.has("squirrel");
+list.add("squirrel");
+let result1 = list.has("squirrel");
```
### get
@@ -181,7 +184,7 @@ Obtains the index of the last occurrence of the specified element in this contai
| Value Type | Description|
| -------- | -------- |
-| number | Returns the position index if obtained; returns **-1** otherwise.|
+| number | Returns the index if obtained; returns **-1** otherwise.|
**Example**
@@ -265,7 +268,7 @@ obj1.add(2);
obj1.add(4);
obj1.add(5);
list.equal(obj1);
-let obj2 = {name : "lala", age : "13"};
+let obj2 = {name : "Dylon", age : "13"};
let result = list.equal(obj2);
```
diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md
index 96b190f1f7f9166c68ef1fda64bb9a98bf6b269d..fca68b5554d6239a03415892d68570dc1b4e8574 100644
--- a/en/application-dev/reference/apis/js-apis-media.md
+++ b/en/application-dev/reference/apis/js-apis-media.md
@@ -53,7 +53,7 @@ Creates a **VideoPlayer** instance. This API uses an asynchronous callback to re
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ------------------------------ |
-| callback | AsyncCallback<[VideoPlayer](#videoplayer8)> | Yes | Callback used to return the **VideoPlayer** instance created.|
+| callback | AsyncCallback<[VideoPlayer](#videoplayer8)> | Yes | Callback used to return the **VideoPlayer** instance, which can be used to manage and play video media.|
**Example**
@@ -82,7 +82,7 @@ Creates a **VideoPlayer** instance. This API uses a promise to return the result
| Type | Description |
| ------------------------------------- | ----------------------------------- |
-| Promise<[VideoPlayer](#videoplayer8)> | Promise used to return the **VideoPlayer** instance created.|
+| Promise<[VideoPlayer](#videoplayer8)> | Promise used to return the **VideoPlayer** instance, which can be used to manage and play video media.|
**Example**
@@ -135,7 +135,7 @@ Only one **AudioRecorder** instance can be created per device.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------- | ---- | ------------------------------ |
-| callback | AsyncCallback<[VideoRecorder](#videorecorder9)> | Yes | Callback used to return the **VideoRecorder** instance created.|
+| callback | AsyncCallback<[VideoRecorder](#videorecorder9)> | Yes | Callback used to return the **VideoRecorder** instance, which can be used to record video media.|
**Example**
@@ -165,7 +165,7 @@ Only one **AudioRecorder** instance can be created per device.
| Type | Description |
| ----------------------------------------- | ----------------------------------- |
-| Promise<[VideoRecorder](#videorecorder9)> | Promise used to return the **VideoRecorder** instance created.|
+| Promise<[VideoRecorder](#videorecorder9)> | Promise used to return the **VideoRecorder** instance, which can be used to record video media.|
**Example**
@@ -275,15 +275,15 @@ For details about the audio playback demo, see [Audio Playback Development](../.
**System capability**: SystemCapability.Multimedia.Media.AudioPlayer
-| Name | Type | Readable| Writable| Description |
-| ------------------------------- | ----------------------------------- | ---- | ---- | ------------------------------------------------------------ |
-| src | string | Yes | Yes | Audio file URI. The mainstream audio formats (M4A, AAC, MPEG-3, OGG, and WAV) are supported. **Examples of supported URI schemes**: 1. FD: fd://xx  2. HTTP: http://xx 3. HTTPS: https://xx 4. HLS: http://xx or https://xx **Required permissions**: ohos.permission.INTERNET|
-| fdSrc9+ | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | Description of the audio file. This attribute is required when audio resources of an application are continuously stored in a file. **Example:** Assume that a music file that stores continuous music resources consists of the following: Music 1 (address offset: 0, byte length: 100) Music 2 (address offset: 101; byte length: 50) Music 3 (address offset: 151, byte length: 150) 1. To play music 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; } 2. To play music 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; } 3. To play music 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; } If the file is an independent music file, use **src=fd://xx**. |
-| loop | boolean | Yes | Yes | Whether to loop audio playback. The value **true** means to loop audio playback, and **false** means the opposite. |
-| audioInterruptMode9+ | [audio.InterruptMode](js-apis-audio.md#interruptmode9) | Yes | Yes | Audio interruption mode. |
-| currentTime | number | Yes | No | Current audio playback position, in ms. |
-| duration | number | Yes | No | Audio duration, in ms. |
-| state | [AudioState](#audiostate) | Yes | No | Audio playback state. This state cannot be used as the condition for triggering the call of **play()**, **pause()**, or **stop()**.|
+| Name | Type | Readable| Writable| Description |
+| ------------------------------- | ------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
+| src | string | Yes | Yes | Audio file URI. The mainstream audio formats (M4A, AAC, MPEG-3, OGG, and WAV) are supported. **Examples of supported URI schemes**: 1. FD: fd://xx  2. HTTP: http://xx 3. HTTPS: https://xx 4. HLS: http://xx or https://xx **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.INTERNET|
+| fdSrc9+ | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | Description of the audio file. This attribute is required when audio resources of an application are continuously stored in a file. **Example:** Assume that a music file that stores continuous music resources consists of the following: Music 1 (address offset: 0, byte length: 100) Music 2 (address offset: 101; byte length: 50) Music 3 (address offset: 151, byte length: 150) 1. To play music 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; } 2. To play music 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; } 3. To play music 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; } If the file is an independent music file, use **src=fd://xx**. |
+| loop | boolean | Yes | Yes | Whether to loop audio playback. The value **true** means to loop audio playback, and **false** means the opposite. |
+| audioInterruptMode9+ | [audio.InterruptMode](js-apis-audio.md#interruptmode9) | Yes | Yes | Audio interruption mode. |
+| currentTime | number | Yes | No | Current audio playback position, in ms. |
+| duration | number | Yes | No | Audio duration, in ms. |
+| state | [AudioState](#audiostate) | Yes | No | Audio playback state. This state cannot be used as the condition for triggering the call of **play()**, **pause()**, or **stop()**.|
### play
play(): void
@@ -442,7 +442,7 @@ function printfDescription(obj) {
}
}
-audioPlayer.getTrackDescription((error, ) => {
+audioPlayer.getTrackDescription((error, arrlist) => {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
@@ -680,7 +680,7 @@ For details about the video playback demo, see [Video Playback Development](../.
| Name | Type | Readable| Writable| Description |
| ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ |
-| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported. **Example of supported URIs**: 1. FD: fd://xx  2. HTTP: http://xx 3. HTTPS: https://xx 4. HLS: http://xx or https://xx **Required permissions**: ohos.permission.INTERNET|
+| url8+ | string | Yes | Yes | Video media URL. The mainstream video formats (MPEG-4, MPEG-TS, WebM, and MKV) are supported. **Example of supported URIs**: 1. FD: fd://xx  2. HTTP: http://xx 3. HTTPS: https://xx 4. HLS: http://xx or https://xx |
| fdSrc9+ | [AVFileDescriptor](#avfiledescriptor9) | Yes| Yes| Description of a video file. This attribute is required when video resources of an application are continuously stored in a file. **Example:** Assume that a music file that stores continuous music resources consists of the following: Video 1 (address offset: 0, byte length: 100) Video 2 (address offset: 101; byte length: 50) Video 3 (address offset: 151, byte length: 150) 1. To play video 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; } 2. To play video 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; } 3. To play video 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; } To play an independent video file, use **src=fd://xx**. |
| loop8+ | boolean | Yes | Yes | Whether to loop video playback. The value **true** means to loop video playback, and **false** means the opposite. |
| videoScaleType9+ | [VideoScaleType](#videoscaletype9) | Yes | Yes | Video scale type. |
@@ -1795,7 +1795,7 @@ Subscribes to the audio recording events.
```js
let audioRecorder = media.createAudioRecorder(); // Create an AudioRecorder instance.
let audioRecorderConfig = {
- audioEncoder : media.AudioEncoder.AAC_LC, ,
+ audioEncoder : media.AudioEncoder.AAC_LC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : 2,
@@ -1850,7 +1850,7 @@ Subscribes to audio recording error events. After an error event is reported, yo
```js
let audioRecorderConfig = {
- audioEncoder : media.AudioEncoder.AAC_LC, ,
+ audioEncoder : media.AudioEncoder.AAC_LC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : 2,
@@ -1974,29 +1974,13 @@ let videoConfig = {
}
// asyncallback
-let videoRecorder = null;
-let events = require('events');
-let eventEmitter = new events.EventEmitter();
-
-eventEmitter.on('prepare', () => {
- videoRecorder.prepare(videoConfig, (err) => {
- if (err == null) {
- console.info('prepare success');
- } else {
- console.info('prepare failed and error is ' + err.message);
- }
- });
-});
-
-media.createVideoRecorder((err, recorder) => {
- if (err == null && recorder != null) {
- videoRecorder = recorder;
- console.info('createVideoRecorder success');
- eventEmitter.emit('prepare'); // Trigger the 'prepare' event.
+videoRecorder.prepare(videoConfig, (err) => {
+ if (err == null) {
+ console.info('prepare success');
} else {
- console.info('createVideoRecorder failed and error is ' + err.message);
+ console.info('prepare failed and error is ' + err.message);
}
-});
+})
```
### prepare9+
@@ -2047,21 +2031,10 @@ let videoConfig = {
}
// promise
-let videoRecorder = null;
-media.createVideoRecorder().then((recorder) => {
- if (recorder != null) {
- videoRecorder = recorder;
- console.info('createVideoRecorder success');
- videoRecorder.prepare(videoConfig).then(() => {
- console.info('prepare success');
- }).catch((err) => {
- console.info('prepare failed and catch error is ' + err.message);
- });
- } else {
- console.info('createVideoRecorder failed');
- }
+videoRecorder.prepare(videoConfig).then(() => {
+ console.info('prepare success');
}).catch((err) => {
- console.info('catch err error message is ' + err.message);
+ console.info('prepare failed and catch error is ' + err.message);
});
```
@@ -2475,11 +2448,10 @@ Subscribes to video recording error events. After an error event is reported, yo
**Example**
```js
+// This event is reported when an error occurs during the retrieval of videoRecordState.
videoRecorder.on('error', (error) => { // Set the 'error' event callback.
console.info(`audio error called, error: ${error}`);
-}
-// This event is reported when an error occurs during the retrieval of videoRecordState.
-});
+})
```
## VideoRecordState9+
diff --git a/en/application-dev/reference/apis/js-apis-medialibrary.md b/en/application-dev/reference/apis/js-apis-medialibrary.md
index b66eeec85c124ac083b27859849a86e1a5f1d4c2..2887044269488b47e2a4f434447b43d617a16f05 100644
--- a/en/application-dev/reference/apis/js-apis-medialibrary.md
+++ b/en/application-dev/reference/apis/js-apis-medialibrary.md
@@ -2,10 +2,10 @@
> **NOTE**
>
-> This component is supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version.
+> The APIs of this module are supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
-```
+```js
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
```
@@ -33,17 +33,18 @@ This API can be used only in the stage model.
**Example (from API version 9)**
-```
-var media = mediaLibrary.getMediaLibrary(this.context);
+```ts
+const context = getContext(this);
+let media = mediaLibrary.getMediaLibrary(context);
```
**Example (API version 8)**
-```
+```js
import featureAbility from '@ohos.ability.featureAbility';
-var context = featureAbility.getContext()
-var media = mediaLibrary.getMediaLibrary(context);
+let context = featureAbility.getContext();
+let media = mediaLibrary.getMediaLibrary(context);
```
## mediaLibrary.getMediaLibrary
@@ -68,7 +69,7 @@ This API can be used only in the FA model.
**Example**
```js
-var media = mediaLibrary.getMediaLibrary();
+let media = mediaLibrary.getMediaLibrary();
```
## MediaLibrary
@@ -93,24 +94,45 @@ Obtains file assets (also called files). This API uses an asynchronous callback
**Example**
-```
-let fileKeyObj = mediaLibrary.FileKey
-let imageType = mediaLibrary.MediaType.IMAGE
-let imagesfetchOp = {
+```js
+let fileKeyObj = mediaLibrary.FileKey;
+let imageType = mediaLibrary.MediaType.IMAGE;
+let imagesFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
};
-media.getFileAssets(imagesfetchOp, (error, fetchFileResult) => {
- if (fetchFileResult != undefined) {
- console.info('mediaLibraryTest : ASSET_CALLBACK fetchFileResult success');
- fetchFileResult.getAllObject((err, fileAssetList) => {
- if (fileAssetList != undefined) {
- fileAssetList.forEach(function(getAllObjectInfo){
- console.info("getAllObjectInfo.displayName :" + getAllObjectInfo.displayName);
- });
- }
- });
+media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => {
+ if (fetchFileResult == undefined) {
+ console.error('Failed to get fetchFileResult: ' + error);
+ return;
}
+ const count = fetchFileResult.getCount();
+ if (count < 0) {
+ console.error('Failed to get count from fetchFileResult: count: ' + count);
+ return;
+ }
+ if (count == 0) {
+ console.info('The count of fetchFileResult is zero');
+ return;
+ }
+
+ console.info('Get fetchFileResult success, count: ' + count);
+ fetchFileResult.getFirstObject((err, fileAsset) => {
+ if (fileAsset == undefined) {
+ console.error('Failed to get first object: ' + err);
+ return;
+ }
+ console.log('fileAsset.displayName ' + ': ' + fileAsset.displayName);
+ for (let i = 1; i < count; i++) {
+ fetchFileResult.getNextObject((err, fileAsset) => {
+ if (fileAsset == undefined) {
+ console.error('Failed to get next object: ' + err);
+ return;
+ }
+ console.log('fileAsset.displayName ' + i + ': ' + fileAsset.displayName);
+ })
+ }
+ });
});
```
### getFileAssets7+
@@ -137,17 +159,38 @@ Obtains file assets. This API uses a promise to return the result.
**Example**
-```
-let fileKeyObj = mediaLibrary.FileKey
-let imageType = mediaLibrary.MediaType.IMAGE
-let imagesfetchOp = {
+```js
+let fileKeyObj = mediaLibrary.FileKey;
+let imageType = mediaLibrary.MediaType.IMAGE;
+let imagesFetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
};
-media.getFileAssets(imagesfetchOp).then(function(fetchFileResult){
- console.info("getFileAssets successfully: image number is "+ fetchFileResult.getCount());
+media.getFileAssets(imagesFetchOp).then(function(fetchFileResult) {
+ const count = fetchFileResult.getCount();
+ if (count < 0) {
+ console.error('Failed to get count from fetchFileResult: count: ' + count);
+ return;
+ }
+ if (count == 0) {
+ console.info('The count of fetchFileResult is zero');
+ return;
+ }
+ console.info('Get fetchFileResult success, count: ' + count);
+ fetchFileResult.getFirstObject().then(function(fileAsset) {
+ console.log('fileAsset.displayName ' + ': ' + fileAsset.displayName);
+ for (let i = 1; i < count; i++) {
+ fetchFileResult.getNextObject().then(function(fileAsset) {
+ console.log('fileAsset.displayName ' + ': ' + fileAsset.displayName);
+ }).catch(function(err) {
+ console.error('Failed to get next object: ' + err);
+ })
+ }
+ }).catch(function(err) {
+ console.error('Failed to get first object: ' + err);
+ });
}).catch(function(err){
- console.info("getFileAssets failed with error:"+ err);
+ console.error("Failed to get file assets: " + err);
});
```
@@ -168,7 +211,7 @@ Subscribes to the media library changes. This API uses an asynchronous callback
**Example**
-```
+```js
media.on('imageChange', () => {
// image file had changed, do something
})
@@ -190,13 +233,13 @@ Unsubscribes from the media library changes. This API uses an asynchronous callb
**Example**
-```
+```js
media.off('imageChange', () => {
// stop listening success
})
```
-### createAsset 8+
+### createAsset8+
createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback<FileAsset>): void
@@ -217,7 +260,7 @@ Creates a media asset. This API uses an asynchronous callback to return the resu
**Example**
-```
+```js
async function example() {
// Create an image file in callback mode.
let mediaType = mediaLibrary.MediaType.IMAGE;
@@ -259,7 +302,7 @@ Creates a media asset. This API uses a promise to return the result.
**Example**
-```
+```js
let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
media.getPublicDirectory(DIR_CAMERA).then(function(dicResult){
console.info("getPublicDirectory successfully:"+ JSON.stringify(dicResult));
@@ -268,6 +311,101 @@ media.getPublicDirectory(DIR_CAMERA).then(function(dicResult){
});
```
+### deleteAsset8+
+
+deleteAsset(uri: string): Promise\
+
+Deletes a file asset. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------- | ---- | --------------- |
+| uri | string | Yes | URI of the file asset to delete.|
+
+**Return value**
+| Type | Description |
+| ------------------- | -------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+```js
+async function example() {
+ let fileKeyObj = mediaLibrary.FileKey;
+ let fileType = mediaLibrary.MediaType.FILE;
+ let option = {
+ selections: fileKeyObj.MEDIA_TYPE + '= ?',
+ selectionArgs: [fileType.toString()],
+ };
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ const fetchFileResult = await media.getFileAssets(option);
+ let asset = await fetchFileResult.getFirstObject();
+ if (asset == undefined) {
+ console.error('asset not exist')
+ return
+ }
+ media.deleteAsset(asset.uri).then(() => {
+ console.info("deleteAsset successfully");
+ }).catch((err) => {
+ console.info("deleteAsset failed with error:"+ err);
+ });
+}
+```
+
+### deleteAsset8+
+deleteAsset(uri: string, callback: AsyncCallback\): void
+
+Deletes a file asset. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------- | ---- | --------------- |
+| uri | string | Yes | URI of the file asset to delete.|
+|callback |AsyncCallback\| Yes |Callback used to return the result.|
+
+**Example**
+
+```js
+async function example() {
+ let fileKeyObj = mediaLibrary.FileKey;
+ let fileType = mediaLibrary.MediaType.FILE;
+ let option = {
+ selections: fileKeyObj.MEDIA_TYPE + '= ?',
+ selectionArgs: [fileType.toString()],
+ };
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ const fetchFileResult = await media.getFileAssets(option);
+ let asset = await fetchFileResult.getFirstObject();
+ if (asset == undefined) {
+ console.error('asset not exist')
+ return
+ }
+ media.deleteAsset(asset.uri, (err) => {
+ if (err != undefined) {
+ console.info("deleteAsset successfully");
+ } else {
+ console.info("deleteAsset failed with error:"+ err);
+ }
+ });
+}
+```
+
### getPublicDirectory8+
getPublicDirectory(type: DirectoryType, callback: AsyncCallback<string>): void
@@ -285,7 +423,7 @@ Obtains a public directory. This API uses an asynchronous callback to return the
**Example**
-```
+```js
let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
media.getPublicDirectory(DIR_CAMERA, (err, dicResult) => {
if (dicResult == 'Camera/') {
@@ -318,7 +456,7 @@ Obtains a public directory. This API uses a promise to return the result.
**Example**
-```
+```js
async function example() {
let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA;
const dicResult = await media.getPublicDirectory(DIR_CAMERA);
@@ -349,7 +487,7 @@ Obtains the albums. This API uses an asynchronous callback to return the result.
**Example**
-```
+```js
let AlbumNoArgsfetchOp = {
selections: '',
selectionArgs: [],
@@ -389,7 +527,7 @@ Obtains the albums. This API uses a promise to return the result.
**Example**
-```
+```js
let AlbumNoArgsfetchOp = {
selections: '',
selectionArgs: [],
@@ -418,7 +556,7 @@ Call this API when you no longer need to use the APIs in the **MediaLibrary** in
**Example**
-```
+```js
var media = mediaLibrary.getMediaLibrary(context);
media.release((err) => {
// do something
@@ -442,7 +580,7 @@ Call this API when you no longer need to use the APIs in the **MediaLibrary** in
**Example**
-```
+```js
media.release()
```
@@ -467,7 +605,7 @@ Stores a media asset. This API uses an asynchronous callback to return the URI t
**Example**
- ```
+```js
let option = {
src : "/data/storage/el2/base/haps/entry/image.png",
mimeType : "image/*",
@@ -481,7 +619,7 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => {
console.log("Media asset stored.");
// Obtain the URI that stores the media asset.
});
- ```
+```
### storeMediaAsset(deprecated)
@@ -510,7 +648,7 @@ Stores a media asset. This API uses a promise to return the URI that stores the
**Example**
- ```
+```js
let option = {
src : "/data/storage/el2/base/haps/entry/image.png",
mimeType : "image/*",
@@ -522,7 +660,7 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => {
}).catch((err) => {
console.log("An error occurred when storing the media assets.");
});
- ```
+```
### startImagePreview(deprecated)
@@ -547,7 +685,7 @@ Starts image preview, with the first image to preview specified. This API can be
**Example**
- ```
+```js
let images = [
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
@@ -566,7 +704,7 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (err) => {
}
console.log("Succeeded in previewing the images.");
});
- ```
+```
### startImagePreview(deprecated)
@@ -590,7 +728,7 @@ Starts image preview. This API can be used to preview local images whose URIs st
**Example**
- ```
+```js
let images = [
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
@@ -608,7 +746,7 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (err) => {
}
console.log("Succeeded in previewing the images.");
});
- ```
+```
### startImagePreview(deprecated)
@@ -638,7 +776,7 @@ Starts image preview, with the first image to preview specified. This API can be
**Example**
- ```
+```js
let images = [
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
@@ -655,7 +793,7 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => {
}).catch((err) => {
console.log("An error occurred when previewing the images.");
});
- ```
+```
### startMediaSelect(deprecated)
@@ -674,13 +812,13 @@ Starts media selection. This API uses an asynchronous callback to return the lis
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------------ |
-| option | [MediaSelectOption](#mediaselectoption) | Yes | Media selection option. |
+| option | [MediaSelectOption](#mediaselectoptiondeprecated) | Yes | Media selection option. |
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the list of URIs (starting with **dataability://**) that store the selected media assets.|
**Example**
- ```
-let option = {
+```js
+let option : mediaLibrary.MediaSelectOption = {
type : "media",
count : 2
};
@@ -692,7 +830,7 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option, (err, value) => {
console.log("Media asset selected.");
// Obtain the media selection value.
});
- ```
+```
### startMediaSelect(deprecated)
@@ -711,7 +849,7 @@ Starts media selection. This API uses a promise to return the list of URIs that
| Name | Type | Mandatory | Description |
| ------ | --------------------------------------- | ---- | ------- |
-| option | [MediaSelectOption](#mediaselectoption) | Yes | Media selection option.|
+| option | [MediaSelectOption](#mediaselectoptiondeprecated) | Yes | Media selection option.|
**Return value**
@@ -721,8 +859,8 @@ Starts media selection. This API uses a promise to return the list of URIs that
**Example**
- ```
-let option = {
+```js
+let option : mediaLibrary.MediaSelectOption = {
type : "media",
count : 2
};
@@ -733,7 +871,155 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option).then((value) => {
console.log("An error occurred when selecting the media assets.");
});
- ```
+```
+### getActivePeers8+
+
+getActivePeers(): Promise\>;
+
+Obtains information about online peer devices. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
+
+**Return value**
+
+| Type | Description |
+| ------------------- | -------------------- |
+| Promise\> | Promise used to return the online peer devices, in an array of **PeerInfo** objects.|
+
+**Example**
+
+```js
+async function example() {
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ media.getActivePeers().then((devicesInfo) => {
+ if (devicesInfo != undefined) {
+ for (let i = 0; i < devicesInfo.length; i++) {
+ console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId);
+ }
+ } else {
+ console.info('get distributed info is undefined!')
+ }
+ }).catch((err) => {
+ console.info("get distributed info failed with error:" + err);
+ });
+}
+```
+
+### getActivePeers8+
+
+getActivePeers(callback: AsyncCallback\>): void;
+
+Obtains information about online peer devices. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
+
+**Return value**
+
+| Type | Description |
+| ------------------- | -------------------- |
+| callback: AsyncCallback\> | Promise used to return the online peer devices, in an array of **PeerInfo** objects.|
+
+**Example**
+
+```js
+async function example() {
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ media.getActivePeers((err, devicesInfo) => {
+ if (devicesInfo != undefined) {
+ for (let i = 0; i < devicesInfo.length; i++) {
+ console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId);
+ }
+ } else {
+ console.info('get distributed fail, message = ' + err)
+ }
+ })
+}
+```
+
+
+### getAllPeers8+
+
+getAllPeers(): Promise\>;
+
+Obtains information about all peer devices. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
+
+**Return value**
+
+| Type | Description |
+| ------------------- | -------------------- |
+| Promise\> | Promise used to return all peer devices, in an array of **PeerInfo** objects.|
+
+**Example**
+
+```js
+async function example() {
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ media.getAllPeers().then((devicesInfo) => {
+ if (devicesInfo != undefined) {
+ for (let i = 0; i < devicesInfo.length; i++) {
+ console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId);
+ }
+ } else {
+ console.info('get distributed info is undefined!')
+ }
+ }).catch((err) => {
+ console.info("get distributed info failed with error:" + err);
+ });
+}
+```
+
+### getAllPeers8+
+
+getAllPeers(callback: AsyncCallback\>): void;
+
+Obtains information about online peer devices. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.READ_MEDIA
+
+**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
+
+**Return value**
+
+| Type | Description |
+| ------------------- | -------------------- |
+| callback: AsyncCallback\> | Promise used to return all peer devices, in an array of **PeerInfo** objects.|
+
+**Example**
+
+```js
+async function example() {
+ const context = getContext(this);
+ var media = mediaLibrary.getMediaLibrary(context);
+ media.getAllPeers((err, devicesInfo) => {
+ if (devicesInfo != undefined) {
+ for (let i = 0; i < devicesInfo.length; i++) {
+ console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId);
+ }
+ } else {
+ console.info('get distributed fail, message = ' + err)
+ }
+ })
+}
+```
## FileAsset7+
@@ -786,7 +1072,7 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -822,7 +1108,7 @@ Checks whether this file asset is a directory. This API uses a promise to return
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -860,7 +1146,7 @@ Commits the modification in this file asset to the database. This API uses an as
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -897,7 +1183,7 @@ Commits the modification in this file asset to the database. This API uses a pro
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -937,7 +1223,7 @@ Opens this file asset. This API uses an asynchronous callback to return the resu
**Example**
-```
+```js
async function example() {
let mediaType = mediaLibrary.MediaType.IMAGE;
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE;
@@ -981,7 +1267,7 @@ Opens this file asset. This API uses a promise to return the result.
**Example**
-```
+```js
async function example() {
let mediaType = mediaLibrary.MediaType.IMAGE;
let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE;
@@ -1016,7 +1302,7 @@ Closes this file asset. This API uses an asynchronous callback to return the res
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -1032,7 +1318,7 @@ async function example() {
console.info('File fd!' + fd);
asset.close(fd, (closeErr) => {
if (closeErr != undefined) {
- console.info('mediaLibraryTest : close : FAIL ' + closeErr.message);
+ console.info('mediaLibraryTest : close : FAIL ' + closeErr);
console.info('mediaLibraryTest : ASSET_CALLBACK : FAIL');
} else {
console.info("=======asset.close success====>");
@@ -1069,7 +1355,7 @@ Closes this file asset. This API uses a promise to return the result.
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -1085,7 +1371,7 @@ async function example() {
console.info('File fd!' + fd);
asset.close(fd).then((closeErr) => {
if (closeErr != undefined) {
- console.info('mediaLibraryTest : close : FAIL ' + closeErr.message);
+ console.info('mediaLibraryTest : close : FAIL ' + closeErr);
console.info('mediaLibraryTest : ASSET_CALLBACK : FAIL');
} else {
@@ -1117,7 +1403,7 @@ Obtains the thumbnail of this file asset. This API uses an asynchronous callback
**Example**
-```
+```js
async function example() {
let fileKeyObj = mediaLibrary.FileKey
let imageType = mediaLibrary.MediaType.IMAGE;
@@ -1130,7 +1416,7 @@ async function example() {
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail((err, pixelmap) => {
- console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
+ console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap);
});
}
```
@@ -1154,9 +1440,9 @@ Obtains the thumbnail of this file asset, with the thumbnail size passed. This A
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1168,7 +1454,7 @@ async function example() {
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size, (err, pixelmap) => {
- console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
+ console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap);
});
}
```
@@ -1197,9 +1483,9 @@ Obtains the thumbnail of this file asset, with the thumbnail size passed. This A
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1212,7 +1498,7 @@ async function example() {
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size)
.then((pixelmap) => {
- console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
+ console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap);
})
.catch((err) => {
console.info('mediaLibraryTest : getThumbnail fail'+ err);
@@ -1239,9 +1525,9 @@ Favorites or unfavorites this file asset. This API uses an asynchronous callback
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1281,9 +1567,9 @@ Favorites or unfavorites this file asset. This API uses a promise to return the
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1319,9 +1605,9 @@ Checks whether this file asset is favorited. This API uses an asynchronous callb
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1359,9 +1645,9 @@ Checks whether this file asset is favorited. This API uses a promise to return t
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1400,9 +1686,9 @@ Files in the trash are not actually deleted. You can set **isTrash** to **false*
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1445,9 +1731,9 @@ Files in the trash are not actually deleted. You can set **isTrash** to **false*
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1483,9 +1769,9 @@ Checks whether this file asset is in the trash. This API uses an asynchronous ca
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1495,18 +1781,13 @@ async function example() {
};
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
- asset.isTrash(isTrashCallBack);
- function isTrashCallBack(err, isTrash) {
- if (isTrash == true) {
- console.info('mediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK isTrash = ' + isTrash);
- asset.trash(true, istrashCallBack);
-
- } else {
- console.info('mediaLibraryTest : ASSET_CALLBACK isTrash Unsuccessfull = ' + err);
- console.info('mediaLibraryTest : ASSET_CALLBACK isTrash : FAIL');
-
- }
- }
+ asset.isTrash((err, isTrash) => {
+ if (isTrash == undefined) {
+ console.error('Failed to get trash state: ' + err);
+ return;
+ }
+ console.info('Get trash state success: ' + isTrash);
+ });
}
```
@@ -1528,22 +1809,21 @@ Checks whether this file asset is in the trash. This API uses a promise to retur
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()],
order: fileKeyObj.DATE_ADDED + " DESC",
- extendArgs: "",
};
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.isTrash().then(function(isTrash){
- console.info("isTrash result:"+ isTrash);
+ console.info("isTrash result: " + isTrash);
}).catch(function(err){
- console.info("isTrash failed with error:"+ err);
+ console.error("isTrash failed with error: " + err);
});
}
```
@@ -1568,9 +1848,9 @@ Obtains the total number of files in the result set.
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let fileType = mediaLibrary.MediaType.FILE;
let getFileCountOneOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1599,9 +1879,9 @@ Checks whether the cursor is in the last row of the result set.
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1637,9 +1917,9 @@ Releases and invalidates this **FetchFileResult** instance. Other APIs in this i
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1668,9 +1948,9 @@ Obtains the first file asset in the result set. This API uses an asynchronous ca
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1705,9 +1985,9 @@ Obtains the first file asset in the result set. This API uses a promise to retur
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1736,13 +2016,13 @@ Obtains the next file asset in the result set. This API uses an asynchronous cal
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ----------------------------------------- |
-| callbacke | AsyncCallback<[FileAsset](#fileasset7)> | Yes | Callback used to return the next file asset.|
+| callback | AsyncCallback<[FileAsset](#fileasset7)> | Yes | Callback used to return the next file asset.|
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1777,9 +2057,9 @@ Obtains the next file asset in the result set. This API uses a promise to return
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1810,9 +2090,9 @@ Obtains the last file asset in the result set. This API uses an asynchronous cal
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1847,9 +2127,9 @@ Obtains the last file asset in the result set. This API uses a promise to return
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1879,9 +2159,9 @@ Obtains a file asset with the specified index in the result set. This API uses a
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1922,9 +2202,9 @@ Obtains a file asset with the specified index in the result set. This API uses a
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1934,9 +2214,9 @@ async function example() {
};
let fetchFileResult = await media.getFileAssets(getImageOp);
fetchFileResult.getPositionObject(1) .then(function (fileAsset){
- console.log('[Demo] fileAsset.displayName : ' + fileAsset.displayName);
+ console.log('fileAsset.displayName : ' + fileAsset.displayName);
}).catch(function (err) {
- console.info("[Demo] getFileAssets failed with error:" + err);
+ console.info("getFileAssets failed with error:" + err);
});
}
```
@@ -1957,9 +2237,9 @@ Obtains all the file assets in the result set. This API uses an asynchronous cal
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -1969,11 +2249,13 @@ async function example() {
};
let fetchFileResult = await media.getFileAssets(getImageOp);
fetchFileResult.getAllObject((err, fileAsset) => {
- if (err) {
+ if (err) {
console.error('Failed ');
return;
- }
- console.log('fileAsset.displayName : ' + fileAsset.displayName);
+ }
+ for (let i = 0; i < fetchFileResult.getCount(); i++) {
+ console.log('fileAsset.displayName : ' + fileAsset[i].displayName);
+ }
})
}
```
@@ -1994,9 +2276,9 @@ Obtains all the file assets in the result set. This API uses a promise to return
**Example**
-```
+```js
async function example() {
- let fileKeyObj = mediaLibrary.FileKey
+ let fileKeyObj = mediaLibrary.FileKey;
let imageType = mediaLibrary.MediaType.IMAGE;
let getImageOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?',
@@ -2045,7 +2327,7 @@ Commits the modification in the album attributes to the database. This API uses
**Example**
-```
+```js
async function example() {
let AlbumNoArgsfetchOp = {
selections: '',
@@ -2082,7 +2364,7 @@ Commits the modification in the album attributes to the database. This API uses
**Example**
-```
+```js
async function example() {
let AlbumNoArgsfetchOp = {
selections: '',
@@ -2118,7 +2400,7 @@ Obtains the file assets in this album. This API uses an asynchronous callback to
**Example**
-```
+```js
async function example() {
let AlbumNoArgsfetchOp = {
selections: '',
@@ -2161,7 +2443,7 @@ Obtains the file assets in this album. This API uses a promise to return the res
**Example**
-```
+```js
async function example() {
let AlbumNoArgsfetchOp = {
selections: '',
@@ -2170,7 +2452,7 @@ async function example() {
let fileNoArgsfetchOp = {
selections: '',
selectionArgs: [],
- }
+ };
const albumList = await media.getAlbums(AlbumNoArgsfetchOp);
const album = albumList[0];
album.getFileAssets(fileNoArgsfetchOp).then(function(albumFetchFileResult){
@@ -2184,7 +2466,8 @@ async function example() {
## PeerInfo8+
Describes information about a registered device.
-This is a system API.
+
+**System API**: This is a system API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
@@ -2256,7 +2539,8 @@ Enumerates directory types.
## DeviceType8+
Enumerates device types.
-This is a system API.
+
+**System API**: This is a system API.
**System capability**: SystemCapability.Multimedia.MediaLibrary.DistributedCore
@@ -2280,7 +2564,7 @@ Describes options for fetching media files.
| ----------------------- | ------------------- | ---- | ---- | ---- | ------------------------------------------------------------ |
| selections | string | Yes | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example: selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', |
| selectionArgs | Array<string> | Yes | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**. Example: selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], |
-| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example: Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC" Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC" |
+| order | string | Yes | Yes | No | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example: Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC" Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"|
| uri8+ | string | Yes | Yes | No | File URI. |
| networkId8+ | string | Yes | Yes | No | Network ID of the registered device. |
| extendArgs8+ | string | Yes | Yes | No | Extended parameters for fetching the files. Currently, no extended parameters are available. |
@@ -2288,6 +2572,7 @@ Describes options for fetching media files.
## Size8+
Describes the image size.
+
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable | Writable | Description |
diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md
index 97a293e22137964215cbbfae1e86b768f7e5acaf..a4692039779fa40b82edb8de1dab204423ac957d 100644
--- a/en/application-dev/reference/apis/js-apis-osAccount.md
+++ b/en/application-dev/reference/apis/js-apis-osAccount.md
@@ -1,4 +1,4 @@
-# OS Account Management
+# OS Account Management
The **osAccount** module provides basic capabilities for managing operating system (OS) accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account, and storing OS account data to disks.
@@ -3163,7 +3163,7 @@ This is a system API and cannot be called by third-party applications.
| FACE_AUTH_TIP_POOR_GAZE | 10 | The face is not facing the device. |
| FACE_AUTH_TIP_NOT_DETECTED | 11 | No face is detected. |
-## ingerprintTips8+
+## FingerprintTips8+
Enumerates the tip codes for fingerprint authentication.
diff --git a/en/application-dev/reference/apis/js-apis-plainarray.md b/en/application-dev/reference/apis/js-apis-plainarray.md
index 4af1fc423938baa39a4ea5771202b0013a65aaec..568a479679c9457babba38a8da53e9a082f74f40 100644
--- a/en/application-dev/reference/apis/js-apis-plainarray.md
+++ b/en/application-dev/reference/apis/js-apis-plainarray.md
@@ -12,6 +12,9 @@ Both **PlainArray** and **[LightWeightMap](js-apis-lightweightmap.md)** are used
**Recommended use case**: Use **PlainArray** when you need to store KV pairs whose keys are of the **number** type.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -93,7 +96,7 @@ Checks whether this container contains the specified key.
```ts
let plainArray = new PlainArray();
plainArray.has(1);
-plainArray.add(1, "sddfhf");
+plainArray.add(1, "squirrel");
let result1 = plainArray.has(1);
```
@@ -122,8 +125,8 @@ Obtains the value of the specified key in this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let result = plainArray.get(1);
```
@@ -152,8 +155,8 @@ Obtains the index of the first occurrence of an element with the specified key i
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let result = plainArray.getIndexOfKey(2);
```
@@ -182,9 +185,9 @@ Obtains the index of the first occurrence of an element with the specified value
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
-let result = plainArray.getIndexOfValue("sddfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
+let result = plainArray.getIndexOfValue("squirrel");
```
@@ -212,8 +215,8 @@ Obtains the key of the element at the specified position in this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let result = plainArray.getKeyAt(1);
```
@@ -241,8 +244,8 @@ Obtains the value of an element at the specified position in this container.
```ts
let plainArray = new PlainArray();
- plainArray.add(1, "sddfhf");
- plainArray.add(2, "sffdfhf");
+ plainArray.add(1, "squirrel");
+ plainArray.add(2, "sparrow");
let result = plainArray.getKeyAt(1);
```
@@ -264,8 +267,8 @@ Clones this container and returns a copy. The modification to the copy does not
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let newPlainArray = plainArray.clone();
```
@@ -289,7 +292,7 @@ Adds an element to this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
+plainArray.add(1, "squirrel");
```
@@ -317,8 +320,8 @@ Removes an element with the specified key from this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
plainArray.remove(2);
let result = plainArray.remove(2);
```
@@ -348,8 +351,8 @@ Removes an element at the specified position from this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
plainArray.removeAt(1);
let result = plainArray.removeAt(1);
```
@@ -380,8 +383,8 @@ Removes elements in a specified range from this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let result = plainArray.removeRangeFrom(1, 3);
```
@@ -405,8 +408,8 @@ Sets a value for an element at the specified position in this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
plainArray.setValueAt(1, 3546);
```
@@ -429,8 +432,8 @@ Obtains a string that contains all elements in this container.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
let result = plainArray.toString();
```
@@ -447,8 +450,8 @@ Clears this container and sets its length to **0**.
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
plainArray.clear();
```
@@ -479,8 +482,8 @@ callbackfn
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
plainArray.forEach((value, index) => {
console.log("value:" + value, index);
});
@@ -505,8 +508,8 @@ Obtains an iterator object that contains key-value pairs, where the key is of th
```ts
let plainArray = new PlainArray();
-plainArray.add(1, "sddfhf");
-plainArray.add(2, "sffdfhf");
+plainArray.add(1, "squirrel");
+plainArray.add(2, "sparrow");
// Method 1:
for (let item of plainArray) {
diff --git a/en/application-dev/reference/apis/js-apis-processrunninginfo.md b/en/application-dev/reference/apis/js-apis-processrunninginfo.md
index e26e01dc8f8d7fbb6472d11217f1156ceb1b41b8..f08032456915595af5da869b74aa0ab1888ffb6b 100644
--- a/en/application-dev/reference/apis/js-apis-processrunninginfo.md
+++ b/en/application-dev/reference/apis/js-apis-processrunninginfo.md
@@ -1,10 +1,10 @@
-# ProcessRunningInfo
+# ProcessRunningInfo(deprecated)
The **ProcessRunningInfo** module provides process running information.
> **NOTE**
->
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> - The APIs provided by this module are deprecated since API version 9. You are advised to use [ProcessRunningInformation9+](js-apis-processrunninginformation.md) instead.
+> - The initial APIs of this module are supported since API version 8.
## Usage
@@ -19,9 +19,9 @@ appManager.getProcessRunningInfos((error,data) => {
## Attributes
-**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
- | Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| pid | number | Yes| No| Process ID.|
| uid | number | Yes| No| User ID.|
diff --git a/en/application-dev/reference/apis/js-apis-processrunninginformation.md b/en/application-dev/reference/apis/js-apis-processrunninginformation.md
new file mode 100644
index 0000000000000000000000000000000000000000..a5add77380e1a9173f9d1d1b1e44b2dfee5be38c
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-processrunninginformation.md
@@ -0,0 +1,29 @@
+# ProcessRunningInformation9+
+
+The **ProcessRunningInformation** module provides process running information.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Usage Guidelines
+
+The process running information is obtained through [appManager](js-apis-appmanager.md#appmanagergetprocessrunninginformation9).
+
+```js
+import appManager from '@ohos.application.appManager';
+appManager.getProcessRunningInformation((error,data) => {
+ console.log("getProcessRunningInformation error: " + error.code + " data: " + JSON.stringify(data));
+});
+```
+
+## Attributes
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| pid | number | Yes| No| Process ID.|
+| uid | number | Yes| No| User ID.|
+| processName | string | Yes| No| Process name.|
+| bundleNames | Array<string> | Yes| No| Names of all running bundles in the process.|
diff --git a/en/application-dev/reference/apis/js-apis-queue.md b/en/application-dev/reference/apis/js-apis-queue.md
index a31a72649d0e0ede56771f3fa6c9bf4d25bbefe7..13ae6256d81a27c3fe53466ac175c74486051ee2 100644
--- a/en/application-dev/reference/apis/js-apis-queue.md
+++ b/en/application-dev/reference/apis/js-apis-queue.md
@@ -10,6 +10,9 @@ Unlike **[Deque](js-apis-deque.md)**, which supports insertion and removal at bo
**Recommended use case**: Use **Queue** in FIFO scenarios.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -72,7 +75,7 @@ let result1 = queue.add(1);
queue.add(1);
let b = [1, 2, 3];
queue.add(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
let result3 = queue.add(c);
```
@@ -180,6 +183,7 @@ Obtains an iterator, each item of which is a JavaScript object.
| IterableIterator<T> | Iterator obtained.|
**Example**
+
```ts
let queue = new Queue();
queue.add(2);
diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md
index 8f88d00f0d246628e3669ae376da04191efedb92..550b62ed355d0a09eb57d17c5473c37cd7e45899 100644
--- a/en/application-dev/reference/apis/js-apis-screenshot.md
+++ b/en/application-dev/reference/apis/js-apis-screenshot.md
@@ -55,7 +55,7 @@ Describes the size of the screen region to capture.
## screenshot.save
-save(options?: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>): void
+save(options: ScreenshotOptions, callback: AsyncCallback<image.PixelMap>): void
Takes a screenshot and saves it as a **PixelMap** object. This API uses an asynchronous callback to return the result.
@@ -67,7 +67,7 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
-| options | [ScreenshotOptions](#screenshotoptions) | No | Screenshot settings consist of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set the parameters separately.|
+| options | [ScreenshotOptions](#screenshotoptions) | Yes | Screenshot settings consist of **screenRect**, **imageSize**, **rotation**, and **displayId**. You can set the parameters separately.|
| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | Yes | Callback used to return a **PixelMap** object. |
**Example**
@@ -97,6 +97,35 @@ Takes a screenshot and saves it as a **PixelMap** object. This API uses an async
## screenshot.save
+save(callback: AsyncCallback<image.PixelMap>): void
+
+Takes a screenshot and saves it as a **PixelMap** object. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.WindowManager.WindowManager.Core
+
+**Required permissions**: ohos.permission.CAPTURE_SCREEN (available only to system applications)
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
+| callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | Yes | Callback used to return a **PixelMap** object. |
+
+**Example**
+
+ ```js
+ screenshot.save((err, pixelMap) => {
+ if (err) {
+ console.log('Failed to save screenshot: ' + JSON.stringify(err));
+ return;
+ }
+ console.log('Succeeded in saving sreenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber());
+ pixelMap.release(); // Release the memory in time after the PixelMap is used.
+ });
+ ```
+
+## screenshot.save
+
save(options?: ScreenshotOptions): Promise<image.PixelMap>
Takes a screenshot and saves it as a **PixelMap** object. This API uses a promise to return the result.
diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md
index b590efb7ca3455c95c3d217b86e741848c5ac547..77dd0bc0560d11837a5cfbb68f38fd3f39075310 100644
--- a/en/application-dev/reference/apis/js-apis-socket.md
+++ b/en/application-dev/reference/apis/js-apis-socket.md
@@ -1041,7 +1041,7 @@ promise1.then(() => {
console.log('connect success');
let promise2 = tcp.getRemoteAddress();
promise2.then(() => {
- console.log('getRemoteAddress success:' + JSON.stringify(data));
+ console.log('getRemoteAddress success');
}).catch(err => {
console.log('getRemoteAddressfail');
});
@@ -1120,7 +1120,7 @@ promise.then(() => {
console.log('connect success');
let promise1 = tcp.getState();
promise1.then(() => {
- console.log('getState success:' + JSON.stringify(data));
+ console.log('getState success');
}).catch(err => {
console.log('getState fail');
});
diff --git a/en/application-dev/reference/apis/js-apis-stack.md b/en/application-dev/reference/apis/js-apis-stack.md
index b1e10e9478bc3335b30cd85498f9feb81b07bfd1..a55afd6a634b5cb284741507140f9a35cf38a527 100644
--- a/en/application-dev/reference/apis/js-apis-stack.md
+++ b/en/application-dev/reference/apis/js-apis-stack.md
@@ -10,6 +10,9 @@ Unlike **[Queue](js-apis-queue.md)**, which is implemented based on the queue da
**Recommended use case**: Use **Stack** in LOFI scenarios.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -73,7 +76,7 @@ let result = stack.push("a");
let result1 = stack.push(1);
let b = [1, 2, 3];
stack.push(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
let result3 = stack.push(c);
```
diff --git a/en/application-dev/reference/apis/js-apis-system-sensor.md b/en/application-dev/reference/apis/js-apis-system-sensor.md
index a551dea9a8f79c5d153649ce69dc912f93ddd4b6..7df5f6675bb53168935ada36ca1d0675e49da978 100644
--- a/en/application-dev/reference/apis/js-apis-system-sensor.md
+++ b/en/application-dev/reference/apis/js-apis-system-sensor.md
@@ -21,9 +21,9 @@ import sensor from '@system.sensor';
## Error Codes
-| Error Code | Description |
-| ---- | -------------- |
-| 900 | The current device does not support the corresponding sensor.|
+| Error Code | Description |
+| ---------- | ---------------------------------------- |
+| 900 | The current device does not support the corresponding sensor. |
## sensor.subscribeAccelerometer
@@ -37,19 +37,19 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------- | ---- | ---------------------------------------- |
-| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
-| success | Function | Yes | Called when the acceleration sensor data changes. |
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | --------- | ---------------------------------------- |
+| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
+| success | Function | Yes | Called when the acceleration sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| ---- | ------ | ------- |
-| x | number | Acceleration on the x-axis.|
-| y | number | Acceleration on the y-axis.|
-| z | number | Acceleration on the z-axis.|
+| Name | Type | Description |
+| ---- | ------ | --------------------------- |
+| x | number | Acceleration on the x-axis. |
+| y | number | Acceleration on the y-axis. |
+| z | number | Acceleration on the z-axis. |
**Example**
@@ -97,16 +97,16 @@ Subscribes to data changes of the compass sensor. If this API is called multiple
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | --------------- |
-| success | Function | Yes | Called when the compass sensor data changes.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the compass sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| --------- | ------ | ---------- |
-| direction | number | Direction of the device, in degrees.|
+| Name | Type | Description |
+| --------- | ------ | ------------------------------------ |
+| direction | number | Direction of the device, in degrees. |
**Example**
@@ -149,16 +149,16 @@ Subscribes to data changes of the proximity sensor. If this API is called multip
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | ----------------- |
-| success | Function | Yes | Called when the proximity sensor data changes.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the proximity sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| -------- | ------ | --------------------- |
-| distance | number | Distance between a visible object and the device screen.|
+| Name | Type | Description |
+| -------- | ------ | ---------------------------------------- |
+| distance | number | Distance between a visible object and the device screen. |
**Example**
@@ -201,16 +201,16 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | --------------- |
-| success | Function | Yes | Called when the ambient light sensor data changes|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the ambient light sensor data changes |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| --------- | ------ | ------------ |
-| intensity | number | Light intensity, in lux.|
+| Name | Type | Description |
+| --------- | ------ | ------------------------ |
+| intensity | number | Light intensity, in lux. |
**Example**
@@ -255,16 +255,16 @@ Subscribes to data changes of the step counter sensor. If this API is called mul
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | ---------------- |
-| success | Function | Yes | Called when the step counter sensor data changes.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the step counter sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| ----- | ------ | --------------------- |
-| steps | number | Number of counted steps after the sensor is restarted. |
+| Name | Type | Description |
+| ----- | ------ | ---------------------------------------- |
+| steps | number | Number of counted steps after the sensor is restarted. |
**Example**
@@ -302,7 +302,7 @@ sensor.unsubscribeStepCounter();
## sensor.subscribeBarometer
-subcribeBarometer(Object): void
+subscribeBarometer(Object): void
Subscribes to data changes of the barometer sensor. If this API is called multiple times for the same application, the last call takes effect.
@@ -310,16 +310,16 @@ Subscribes to data changes of the barometer sensor. If this API is called multip
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | ---------------- |
-| success | Function | Yes | Called when the barometer sensor data changes.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the barometer sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| -------- | ------ | ----------- |
-| pressure | number | Pressure, in pascal.|
+| Name | Type | Description |
+| -------- | ------ | -------------------- |
+| pressure | number | Pressure, in pascal. |
**Example**
@@ -366,16 +366,16 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | ------------------------- |
-| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | ---------------------------------------- |
+| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| --------- | ------ | ---- |
-| heartRate | number | Heart rate.|
+| Name | Type | Description |
+| --------- | ------ | ----------- |
+| heartRate | number | Heart rate. |
**Example**
@@ -421,16 +421,16 @@ Subscribes to changes of the wearing state of a wearable device. If this API is
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | -------- | ---- | ------------- |
-| success | Function | Yes | Called when the wearing state changes.|
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| ------- | -------- | --------- | -------------------------------------- |
+| success | Function | Yes | Called when the wearing state changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| ----- | ------- | ------ |
-| value | boolean | Whether the wearable device is worn.|
+| Name | Type | Description |
+| ----- | ------- | ------------------------------------ |
+| value | boolean | Whether the wearable device is worn. |
**Example**
@@ -473,17 +473,17 @@ Obtains the wearing state of a wearable device.
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------- | ---- | ------------ |
-| success | Function | No | Callback upon success.|
-| fail | Function | No | Callback upon failure.|
-| complete | Function | No | Called when the execution is complete.|
+| Name | Type | Mandatory | Description |
+| -------- | -------- | --------- | -------------------------------------- |
+| success | Function | No | Callback upon success. |
+| fail | Function | No | Callback upon failure. |
+| complete | Function | No | Called when the execution is complete. |
Return values of the success callback
-| Name | Type | Description |
-| ----- | ------- | ------ |
-| value | boolean | Whether the wearable device is worn.|
+| Name | Type | Description |
+| ----- | ------- | ------------------------------------ |
+| value | boolean | Whether the wearable device is worn. |
**Example**
@@ -510,18 +510,18 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------- | ---- | ---------------------------------------- |
-| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
-| success | Function | Yes | Called when the device orientation sensor data changes. |
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | --------- | ---------------------------------------- |
+| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
+| success | Function | Yes | Called when the device orientation sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
+| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
-| alpha | number | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth.|
-| beta | number | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth.|
-| gamma | number | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth.|
+| alpha | number | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth. |
+| beta | number | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth. |
+| gamma | number | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth. |
**Example**
@@ -571,19 +571,19 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------- | ---- | ---------------------------------------- |
-| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
-| success | Function | Yes | Called when the gyroscope sensor data changes. |
-| fail | Function | No | Callback upon failure. |
+| Name | Type | Mandatory | Description |
+| -------- | -------- | --------- | ---------------------------------------- |
+| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
+| success | Function | Yes | Called when the gyroscope sensor data changes. |
+| fail | Function | No | Callback upon failure. |
Return values of the success callback
-| Name | Type | Description |
-| ---- | ------ | --------- |
-| x | number | Rotation angular velocity of the X axis.|
-| y | number | Rotation angular velocity of the Y axis.|
-| z | number | Rotation angular velocity of the Z axis.|
+| Name | Type | Description |
+| ---- | ------ | ---------------------------------------- |
+| x | number | Rotation angular velocity of the X axis. |
+| y | number | Rotation angular velocity of the Y axis. |
+| z | number | Rotation angular velocity of the Z axis. |
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-testRunner.md b/en/application-dev/reference/apis/js-apis-testRunner.md
index bc65de36ea0283d025deb74006dd428d7adefbd7..c82668961c8cf23f5b523024842a786dc4d0979f 100644
--- a/en/application-dev/reference/apis/js-apis-testRunner.md
+++ b/en/application-dev/reference/apis/js-apis-testRunner.md
@@ -29,7 +29,7 @@ export default class UserTestRunner implements TestRunner {
onPrepare() {
console.log("Trigger onPrepare")
}
-onRun(){}
+ onRun(){}
};
```
@@ -50,6 +50,6 @@ export default class UserTestRunner implements TestRunner {
onPrepare() {
console.log("Trigger onRun")
}
-onRun(){}
+ onRun(){}
};
```
diff --git a/en/application-dev/reference/apis/js-apis-treemap.md b/en/application-dev/reference/apis/js-apis-treemap.md
index 7914e5bd409d29b3bcae14653aaa6bd8dd5f6f9c..001b08610c59f25b384c9fc3ada4c74f152b9313 100644
--- a/en/application-dev/reference/apis/js-apis-treemap.md
+++ b/en/application-dev/reference/apis/js-apis-treemap.md
@@ -12,6 +12,10 @@
Recommended use case: Use **TreeMap** when you need to store KV pairs in sorted order.
+This topic uses the following to identify the use of generics:
+- K: Key
+- V: Value
+
## Modules to Import
```ts
@@ -96,9 +100,9 @@ Checks whether this container has the specified key.
```ts
let treeMap = new TreeMap();
-let result = treeMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-let result1 = treeMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = treeMap.hasKey("squirrel");
+treeMap.set("squirrel", 123);
+let result1 = treeMap.hasKey("squirrel");
```
@@ -127,7 +131,7 @@ Checks whether this container has the specified value.
```ts
let treeMap = new TreeMap();
let result = treeMap.hasValue(123);
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+treeMap.set("squirrel", 123);
let result1 = treeMap.hasValue(123);
```
@@ -156,9 +160,9 @@ Obtains the value of the specified key in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
-let result = treeMap.get("sdfs");
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
+let result = treeMap.get("sparrow");
```
@@ -180,8 +184,8 @@ Obtains the first key in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let result = treeMap.getFirstKey();
```
@@ -204,8 +208,8 @@ Obtains the last key in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let result = treeMap.getLastKey();
```
@@ -228,8 +232,8 @@ Adds all elements in a **TreeMap** instance to this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let map = new TreeMap();
treeMap.setAll(map);
```
@@ -260,7 +264,7 @@ Adds an element to this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+treeMap.set("squirrel", 123);
```
@@ -288,9 +292,9 @@ Removes the element with the specified key from this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
-treeMap.remove("sdfs");
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
+treeMap.remove("sparrow");
```
@@ -318,10 +322,10 @@ Obtains the key that is placed in front of the input key in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
-treeMap.set("zdfgsd", 356);
-let result = treeMap.getLowerKey("sdfs");
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
+treeMap.set("gander", 356);
+let result = treeMap.getLowerKey("sparrow");
```
@@ -349,10 +353,10 @@ Obtains the key that is placed next to the input key in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
-treeMap.set("zdfgsd", 356);
-let result = treeMap.getHigherKey("sdfs");
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
+treeMap.set("gander", 356);
+let result = treeMap.getHigherKey("sparrow");
```
### replace
@@ -380,8 +384,8 @@ Replaces an element in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("sdfs", 123);
-let result = treeMap.replace("sdfs", 357);
+treeMap.set("sparrow", 123);
+let result = treeMap.replace("sparrow", 357);
```
@@ -397,8 +401,8 @@ Clears this container and sets its length to **0**.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
treeMap.clear();
```
@@ -421,8 +425,8 @@ Obtains an iterator that contains all the keys in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let iter = treeMap.keys();
let temp = iter.next().value;
while(temp != undefined) {
@@ -450,8 +454,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let iter = treeMap.values();
let temp = iter.next().value;
while(temp != undefined) {
@@ -487,8 +491,8 @@ callbackfn
```ts
let treeMap = new TreeMap();
-treeMap.set("sdfs", 123);
-treeMap.set("dfsghsf", 357);
+treeMap.set("sparrow", 123);
+treeMap.set("gull", 357);
treeMap.forEach((value, key) => {
console.log("value:" + value, key);
});
@@ -513,8 +517,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
let iter = treeMap.entries();
let temp = iter.next().value;
while(temp != undefined) {
@@ -542,8 +546,8 @@ Obtains an iterator, each item of which is a JavaScript object.
```ts
let treeMap = new TreeMap();
-treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
-treeMap.set("sdfs", 356);
+treeMap.set("squirrel", 123);
+treeMap.set("sparrow", 356);
// Method 1:
for (let item of treeMap) {
diff --git a/en/application-dev/reference/apis/js-apis-treeset.md b/en/application-dev/reference/apis/js-apis-treeset.md
index 6e50abcf23c7cf2c3a77e6029244a0078edd1562..9391eb15c944bfa5170c28e4bd1976c346a3356a 100644
--- a/en/application-dev/reference/apis/js-apis-treeset.md
+++ b/en/application-dev/reference/apis/js-apis-treeset.md
@@ -10,6 +10,9 @@
Recommended use case: Use **TreeSet** when you need to store data in sorted order.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -29,7 +32,7 @@ import TreeSet from '@ohos.util.TreeSet';
### constructor
-constructor(comparator?:(firstValue: T, secondValue: T) => boolean)
+constructor(comparator?: (firstValue: T, secondValue: T) => boolean)
A constructor used to create a **TreeSet** instance.
@@ -118,8 +121,8 @@ Obtains the value of the first element in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let result = treeSet.getFirstValue();
```
@@ -142,8 +145,8 @@ Obtains the value of the last element in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let result = treeSet.getLastValue();
```
@@ -172,7 +175,7 @@ Adds an element to this container.
```ts
let treeSet = new TreeSet();
-let result = treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = treeSet.add("squirrel");
```
@@ -200,9 +203,9 @@ Removes the element with the specified key from this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
-let result = treeSet.remove("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
+let result = treeSet.remove("sparrow");
```
@@ -230,10 +233,10 @@ Obtains the value that is placed in front of the input key in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
-treeSet.add("zdfgsd");
-let result = treeSet.getLowerValue("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
+treeSet.add("gander");
+let result = treeSet.getLowerValue("sparrow");
```
@@ -261,10 +264,10 @@ Obtains the value that is placed next to the input key in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
-treeSet.add("zdfgsd");
-let result = treeSet.getHigherValue("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
+treeSet.add("gander");
+let result = treeSet.getHigherValue("sparrow");
```
@@ -286,8 +289,8 @@ Removes the first element in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let result = treeSet.popFirst();
```
@@ -310,8 +313,8 @@ Removes the last element in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let result = treeSet.popLast();
```
@@ -328,8 +331,8 @@ Clears this container and sets its length to **0**.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
treeSet.clear();
```
@@ -352,8 +355,8 @@ Obtains an iterator that contains all the values in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let iter = treeSet.values();
let temp = iter.next().value;
while(temp != undefined) {
@@ -389,8 +392,8 @@ callbackfn
```ts
let treeSet = new TreeSet();
-treeSet.add("sdfs");
-treeSet.add("dfsghsf");
+treeSet.add("sparrow");
+treeSet.add("gull");
treeSet.forEach((value, key) => {
console.log("value:" + value, key)
});
@@ -415,8 +418,8 @@ Obtains an iterator that contains all the elements in this container.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
let iter = treeSet.entries();
let temp = iter.next().value;
while(temp != undefined) {
@@ -445,8 +448,8 @@ Obtains an iterator, each item of which is a JavaScript object.
```ts
let treeSet = new TreeSet();
-treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-treeSet.add("sdfs");
+treeSet.add("squirrel");
+treeSet.add("sparrow");
// Method 1:
for (let item of treeSet) {
diff --git a/en/application-dev/reference/apis/js-apis-update.md b/en/application-dev/reference/apis/js-apis-update.md
index ab8fc8e866ae68175f6ddabc0be83ac1f2803b5f..91013f97245cf0b63073b88c51af91705324038a 100644
--- a/en/application-dev/reference/apis/js-apis-update.md
+++ b/en/application-dev/reference/apis/js-apis-update.md
@@ -7,7 +7,7 @@ There are two types of updates: SD card update and over the air (OTA) update.
- The SD card update depends on the update packages and SD cards.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
-> **Note:**
+> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
@@ -239,7 +239,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
- format: DescriptionFormat.STANDARD, // Standard format
+ format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
@@ -282,7 +282,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
- format: DescriptionFormat.STANDARD, // Standard format
+ format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
@@ -369,7 +369,7 @@ Obtains the description file of the current version. This API uses an asynchrono
```ts
// Options of the description file
var descriptionOptions = {
- format: DescriptionFormat.STANDARD, // Standard format
+ format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
@@ -406,7 +406,7 @@ Obtains the description file of the current version. This API uses a promise to
```ts
// Options of the description file
var descriptionOptions = {
- format: DescriptionFormat.STANDARD, // Standard format
+ format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
@@ -1580,7 +1580,7 @@ Represents an update file.
## UpgradeTaskCallback
-### (eventInfo: [EventInfo](#eventinfo)): void
+(eventInfo: EventInfo): void
Represents an event callback.
diff --git a/en/application-dev/reference/apis/js-apis-url.md b/en/application-dev/reference/apis/js-apis-url.md
index 679dc182e6c06d96248a084e313cc3d1baaea7f9..c060118f7e466da51f2ee5b7fdd6ad20f7e256ca 100755
--- a/en/application-dev/reference/apis/js-apis-url.md
+++ b/en/application-dev/reference/apis/js-apis-url.md
@@ -197,9 +197,9 @@ Obtains the value of the first key-value pair based on the specified key.
**Example**
```js
-let paramsOject = new Url.URLSearchParams('name=Jonathan&age=18');
-let name = paramsOject.get("name"); // is the string "Jonathan"
-let age = parseInt(paramsOject.get("age"), 10); // is the number 18
+let paramsObject = new Url.URLSearchParams('name=Jonathan&age=18');
+let name = paramsObject.get("name"); // is the string "Jonathan"
+let age = parseInt(paramsObject.get("age"), 10); // is the number 18
```
diff --git a/en/application-dev/reference/apis/js-apis-usb.md b/en/application-dev/reference/apis/js-apis-usb.md
index 8979bdeefaaebbd77e0e17bd094313025155527b..d21f6372b5fe26f6e8aeded00e3245b2def23428 100644
--- a/en/application-dev/reference/apis/js-apis-usb.md
+++ b/en/application-dev/reference/apis/js-apis-usb.md
@@ -94,14 +94,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | device | [USBDevice](#usbdevice) | Yes| USB device information.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| device | [USBDevice](#usbdevice) | Yes| USB device information.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.|
+
+| Type| Description|
+| -------- | -------- |
+| Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.|
**Example**
@@ -119,14 +121,16 @@ Checks whether the application has the permission to access the device.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | deviceName | string | Yes| Device name to set.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| deviceName | string | Yes| Device name.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.|
**Example**
@@ -140,19 +144,21 @@ console.log(bool);
requestRight(deviceName: string): Promise<boolean>
-Requests the temporary permission for the application to access the USB device.
+Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | deviceName | string | Yes| Device name to set.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| deviceName | string | Yes| Device name.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<boolean> | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.|
**Example**
@@ -174,16 +180,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
- | iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
- | force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
+| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
+| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.|
**Example**
@@ -203,15 +211,17 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
- | iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
+| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.|
**Example**
@@ -231,15 +241,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
- | config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
+| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.|
**Example**
@@ -266,9 +278,10 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| iface | [USBInterface](#usbinterface) | Yes | USB interface to set. |
**Return value**
- | Type| Description|
- | -------- | -------- |
- | number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.|
**Example**
@@ -289,14 +302,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
+
| Type| Description|
| -------- | -------- |
-| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
+| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.|
**Example**
@@ -315,15 +329,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type | Description |
| ------ | -------------------- |
-| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
+| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.|
**Example**
@@ -342,16 +357,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
- | contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
- | timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
+| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
+| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
+
+| Type| Description|
+| -------- | -------- |
+| Promise<number> | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
@@ -372,17 +389,19 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
- | endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
- | buffer | Uint8Array | Yes| Buffer for writing or reading data.|
- | timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
+| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
+| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
+| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
+
+| Type| Description|
+| -------- | -------- |
+| Promise<number> | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
@@ -406,14 +425,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
+
+| Type| Description|
+| -------- | -------- |
+| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.|
**Example**
@@ -498,8 +519,8 @@ Sets the current USB function list in Device mode.
**Return value**
-| Type | Description |
-| ------------------ | ------------------------------------------------------ |
+| Type | Description |
+| ------------------ | ------------------------------------------------------------ |
| Promise\ | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
@@ -601,8 +622,8 @@ Sets the role types supported by a specified port, which can be **powerRole** (f
**Return value**
-| Type | Description |
-| ------------------ | -------------- |
+| Type | Description |
+| ------------------ | ------------------------------------------------------------ |
| Promise\ | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-useriam-faceauth.md b/en/application-dev/reference/apis/js-apis-useriam-faceauth.md
new file mode 100644
index 0000000000000000000000000000000000000000..60690327946699362eb5b86deaaae3b438897e3e
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-useriam-faceauth.md
@@ -0,0 +1,81 @@
+# Facial Authentication
+
+The **userIAM.faceAuth** module provides APIs for face enrollment.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
+> The APIs provided by this module are system APIs.
+
+## Modules to Import
+
+```js
+import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
+```
+
+## FaceAuthManager
+
+Provides APIs for facial authentication management.
+
+### constructor
+
+constructor()
+
+A constructor used to create a **FaceAuthManager** object.
+
+**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | -------------------- |
+| [FaceAuthManager](#faceauthmanager) | **FaceAuthManager** object.|
+
+**Example**
+
+ ```js
+ import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
+
+ let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
+ ```
+
+### setSurfaceId
+
+setSurfaceId(surfaceId: string): ResultCode;
+
+Sets an [XComponent surface ID](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) for the face preview page in the face enrollment process.
+
+**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ---------------------------------- | ---- | -------------------------- |
+| surfaceId | string | Yes | ID of the surface held by the [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).|
+
+**Return value**
+
+| Type | Description |
+| ---------- | ------------------------------------------------------------ |
+| [ResultCode](#resultcode) | Operation result code.|
+
+**Example**
+
+ ```js
+ import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
+
+ let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
+ faceAuthManager.setSurfaceId("0");
+ ```
+
+## ResultCode
+
+ Enumerates the operation result codes.
+
+ **System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
+
+| Name | Default Value| Description |
+| ----------------------- | ------ | -------------------- |
+| SUCCESS | 0 | The operation is successful. |
+| FAIL | 1 | The operation fails. |
diff --git a/en/application-dev/reference/apis/js-apis-useriam-userauth.md b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
index d98f43faaf7bc2a575cfa80907a776d9436bfbff..a43b77bcf631b9ad1c2882a841af545fbe9669fd 100644
--- a/en/application-dev/reference/apis/js-apis-useriam-userauth.md
+++ b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
@@ -119,8 +119,6 @@ constructor()
A constructor used to create an **authenticator** object.
-**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
-
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
@@ -279,7 +277,8 @@ Cancels an authentication.
// contextId can be obtained using auth(). In this example, it is defined here.
let contextId = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]);
- let cancelCode = auth.cancel(contextId);
+ let auth = new userIAM_userAuth.UserAuth();
+ let cancelCode = auth.cancelAuth(contextId);
if (cancelCode == userIAM_userAuth.ResultCode.SUCCESS) {
console.info("cancel auth success");
} else {
@@ -492,11 +491,10 @@ getAuthenticator(): Authenticator
Obtains an **Authenticator** object for user authentication.
-**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
-
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
+
| Type | Description |
| ----------------------------------------- | ------------ |
| [Authenticator](#authenticatordeprecated) | **Authenticator** object obtained.|
@@ -516,7 +514,7 @@ Provides methods to manage an **Authenticator** object.
### execute(deprecated)
-execute(type: string, level: string, callback: AsyncCallback<number>): void
+execute(type: AuthType, level: SecureLevel, callback: AsyncCallback<number>): void
> **NOTE**
> This API is not longer maintained since API version 8. You are advised to use [auth](#auth8).
@@ -531,8 +529,8 @@ Performs user authentication. This API uses asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Authentication type. Only **FACE_ONLY** is supported. **ALL** is reserved and not supported by the current version.|
-| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest). Devices capable of 3D facial recognition support S3 and lower-level authentication. Devices capable of 2D facial recognition support S2 and lower-level authentication.|
+| type | AuthType | Yes | Authentication type. Only **FACE_ONLY** is supported. **ALL** is reserved and not supported by the current version.|
+| level | SecureLevel | Yes | Security level of the authentication. It can be **S1** (lowest), **S2**, **S3**, or **S4** (highest). Devices capable of 3D facial recognition support S3 and lower-level authentication. Devices capable of 2D facial recognition support S2 and lower-level authentication.|
| callback | AsyncCallback<number> | No | Callback used to return the result. |
Parameters returned in callback
@@ -543,19 +541,20 @@ Performs user authentication. This API uses asynchronous callback to return the
**Example**
```js
- authenticator.execute("FACE_ONLY", "S2", (code)=>{
- if (code == userIAM_userAuth.AuthenticationResult.SUCCESS) {
+ let authenticator = userIAM_userAuth.getAuthenticator();
+ authenticator.execute("FACE_ONLY", "S2", (error, code)=>{
+ if (code === userIAM_userAuth.ResultCode.SUCCESS) {
console.info("auth success");
return;
}
console.error("auth fail, code = " + code);
- })
+ });
```
### execute(deprecated)
-execute(type:string, level:string): Promise<number>
+execute(type:AuthType, level:SecureLevel): Promise<number>
> **NOTE**
> This API is not longer maintained since API version 8. You are advised to use [auth](#auth8).
@@ -567,26 +566,28 @@ Performs user authentication. This API uses a promise to return the result.
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Parameters**
+
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
-| type | string | Yes | Authentication type. Only **FACE_ONLY** is supported. **ALL** is reserved and not supported by the current version.|
-| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest). Devices capable of 3D facial recognition support S3 and lower-level authentication. Devices capable of 2D facial recognition support S2 and lower-level authentication.|
+| type | AuthType | Yes | Authentication type. Only **FACE_ONLY** is supported. **ALL** is reserved and not supported by the current version.|
+| level | SecureLevel | Yes | Security level of the authentication. It can be **S1** (lowest), **S2**, **S3**, or **S4** (highest). Devices capable of 3D facial recognition support S3 and lower-level authentication. Devices capable of 2D facial recognition support S2 and lower-level authentication.|
**Return value**
+
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise<number> | Promise used to return the authentication result, which is a number. For details, see [AuthenticationResult](#authenticationresultdeprecated).|
**Example**
-```js
-let authenticator = userIAM_userAuth.getAuthenticator();
-authenticator.execute("FACE_ONLY", "S2").then((code)=>{
- console.info("auth success");
-}).catch((code)=>{
- console.error("auth fail, code = " + code);
-});
-```
+ ```js
+ let authenticator = userIAM_userAuth.getAuthenticator();
+ authenticator.execute("FACE_ONLY", "S2").then((code)=>{
+ console.info("auth success");
+ }).catch((error)=>{
+ console.error("auth fail, code = " + error);
+ });
+ ```
## AuthenticationResult(deprecated)
diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md
index f9820758decfac7eaef530c4ff3c65aa81544150..eb52d85a2c418842f2cb2d581fb0583917b68622 100755
--- a/en/application-dev/reference/apis/js-apis-util.md
+++ b/en/application-dev/reference/apis/js-apis-util.md
@@ -1015,7 +1015,7 @@ Obtains the value of the specified key.
| Type| Description|
| -------- | -------- |
-| V \| undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
+| V \| undefined | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
**Example**
```js
@@ -1116,7 +1116,7 @@ Removes the specified key and its value from this buffer.
| Type| Description|
| -------- | -------- |
-| V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
+| V \| undefined | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
**Example**
```js
@@ -1291,7 +1291,7 @@ class Temperature{
// private readonly _temp: Temperature;
this._temp = value;
}
- comapreTo(value){
+ compareTo(value){
return this._temp >= value.getTemp();
}
getTemp(){
diff --git a/en/application-dev/reference/apis/js-apis-vector.md b/en/application-dev/reference/apis/js-apis-vector.md
index 5dd8e49bb0c2467b2885784b9c1281f61e46a003..24fc9e14ffe48ebbfd672aa73218c2110757c3d8 100644
--- a/en/application-dev/reference/apis/js-apis-vector.md
+++ b/en/application-dev/reference/apis/js-apis-vector.md
@@ -10,6 +10,9 @@ Both **Vector** and **[ArrayList](js-apis-arraylist.md)** are implemented based
**Recommended use case**: Use **Vector** when the data volume is large.
+This topic uses the following to identify the use of generics:
+- T: Type
+
## Modules to Import
```ts
@@ -71,7 +74,7 @@ let result = vector.add("a");
let result1 = vector.add(1);
let b = [1, 2, 3];
vector.add(b);
-let c = {name : "lala", age : "13"};
+let c = {name : "Dylon", age : "13"};
let result3 = vector.add(c);
```
@@ -123,9 +126,9 @@ Checks whether this container has the specified element.
```ts
let vector = new Vector();
-let result = vector.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-vector.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
-let result1 = vector.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result = vector.has("squirrel");
+vector.add("squirrel");
+let result1 = vector.has("squirrel");
```
### getIndexOf
@@ -862,7 +865,6 @@ Obtains an iterator. Each item of the iterator is a JavaScript object.
**System capability**: SystemCapability.Utils.Lang
**Return value**
-
| Type| Description|
| -------- | -------- |
| IterableIterator<T> | Iterator obtained.|
diff --git a/en/application-dev/reference/apis/js-apis-wifi.md b/en/application-dev/reference/apis/js-apis-wifi.md
index ae5ab4c9b924e6b72457a9bbadec1cfd26ef5e6b..7f5b41145c5831f3ecd0014687a52366b598f9d4 100644
--- a/en/application-dev/reference/apis/js-apis-wifi.md
+++ b/en/application-dev/reference/apis/js-apis-wifi.md
@@ -25,9 +25,9 @@ Enables WLAN.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.disableWifi
@@ -44,9 +44,9 @@ Disables WLAN.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.isWifiActive
@@ -61,9 +61,9 @@ Checks whether WLAN is enabled.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if WLAN is enabled; returns **false** otherwise.|
## wifi.scan
@@ -78,9 +78,9 @@ Starts a scan for WLAN.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.getScanInfos
@@ -95,9 +95,9 @@ Obtains the scan result. This API uses a promise to return the result.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.|
## wifi.getScanInfos
@@ -112,9 +112,9 @@ Obtains the scan result. This API uses an asynchronous callback to return the re
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback< Array<[WifiScanInfo](#wifiscaninfo)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the detected hotspots. Otherwise, **err** is a non-zero value and **data** is empty.|
**Example**
```js
@@ -247,9 +247,9 @@ Obtains the scan result. This API returns the result synchronously.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Array<[WifiScanInfo](#wifiscaninfo)> | Scan result obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Array<[WifiScanInfo](#wifiscaninfo)> | Scan result obtained.|
## wifi.addDeviceConfig
@@ -266,15 +266,15 @@ Adds network configuration. This API uses a promise to return the result.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise<number> | Promise used to return the WLAN configuration ID. If **-1** is returned, the operation has failed.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise<number> | Promise used to return the WLAN configuration ID. If **-1** is returned, the operation has failed.|
## WifiDeviceConfig
@@ -412,10 +412,10 @@ Adds network configuration. This API uses an asynchronous callback to return the
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
- | callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
## wifi.addUntrustedConfig7+
@@ -430,15 +430,15 @@ Adds the configuration of an untrusted network. This API uses a promise to retur
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
## wifi.addUntrustedConfig7+
@@ -453,10 +453,10 @@ Adds the configuration of an untrusted network. This API uses an asynchronous ca
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
- | callback | AsyncCallback<boolean> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is **true**. If the operation fails, **data** is **false**. If **err** is not **0**, an error has occurred.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| callback | AsyncCallback<boolean> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is **true**. If the operation fails, **data** is **false**. If **err** is not **0**, an error has occurred.|
## wifi.removeUntrustedConfig7+
@@ -471,15 +471,15 @@ Removes the configuration of an untrusted network. This API uses a promise to re
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to remove.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to remove.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise<boolean> | Promise used to return the result. If the operation is successful, **true** is returned; otherwise, **false** is returned.|
## wifi.removeUntrustedConfig7+
@@ -494,10 +494,10 @@ Removes the configuration of an untrusted network. This API uses an asynchronous
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to remove.|
- | callback | AsyncCallback<boolean> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is **true**. If the operation fails, **data** is **false**. If **err** is not **0**, an error has occurred.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to remove.|
+| callback | AsyncCallback<boolean> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is **true**. If the operation fails, **data** is **false**. If **err** is not **0**, an error has occurred.|
## wifi.addCandidateConfig9+
@@ -512,15 +512,15 @@ Adds the configuration of a candidate network. This API uses a promise to return
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise<number> | Promise used to return the network configuration ID.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise<number> | Promise used to return the network configuration ID.|
## wifi.addCandidateConfig9+
@@ -535,10 +535,10 @@ Adds the configuration of a candidate network. This API uses an asynchronous cal
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
- | callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration to add.|
+| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the network configuration ID. If **data** is **-1**, the operation has failed. If **err** is not **0**, an error has occurred.|
## wifi.removeCandidateConfig9+
@@ -553,15 +553,15 @@ Removes the configuration of a candidate network. This API uses a promise to ret
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | networkId | number | Yes| ID of the network configuration to remove.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| networkId | number | Yes| ID of the network configuration to remove.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Promise<void> | Promise used to return the result.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Promise<void> | Promise used to return the result.|
## wifi.removeCandidateConfig9+
@@ -576,10 +576,10 @@ Removes the configuration of a candidate network. This API uses an asynchronous
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | networkId | number | Yes| ID of the network configuration to remove.|
- | callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| networkId | number | Yes| ID of the network configuration to remove.|
+| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, the value of **err** is **0**. If **err** is not **0**, an error has occurred.|
## wifi.getCandidateConfigs9+
@@ -594,9 +594,9 @@ Obtains candidate network configuration.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Array<[WifiDeviceConfig](#wifideviceconfig)> | Candidate network configuration obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Array<[WifiDeviceConfig](#wifideviceconfig)> | Candidate network configuration obtained.|
## wifi.connectToCandidateConfig9+
@@ -611,9 +611,9 @@ Connects to a candidate network.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | networkId | number | Yes| ID of the candidate network configuration.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| networkId | number | Yes| ID of the candidate network configuration.|
## wifi.connectToNetwork
@@ -630,15 +630,15 @@ Connects to the specified network.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | networkId | number | Yes| Network configuration ID.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| networkId | number | Yes| Network configuration ID.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.connectToDevice
@@ -656,15 +656,15 @@ Connects to the specified network.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| WLAN configuration.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.disconnect
@@ -682,9 +682,9 @@ Disconnects the network.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.getSignalLevel
@@ -699,16 +699,16 @@ Obtains the WLAN signal level.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | rssi | number | Yes| RSSI of the hotspot, in dBm.|
- | band | number | Yes| Frequency band of the WLAN AP.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| rssi | number | Yes| RSSI of the hotspot, in dBm.|
+| band | number | Yes| Frequency band of the WLAN AP.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | number | Signal level obtained. The value range is [0, 4].|
+| **Type**| **Description**|
+| -------- | -------- |
+| number | Signal level obtained. The value range is [0, 4].|
## wifi.getLinkedInfo
@@ -723,9 +723,9 @@ Obtains WLAN connection information. This API uses a promise to return the resul
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise used to return the WLAN connection information obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise used to return the WLAN connection information obtained.|
## wifi.getLinkedInfo
@@ -740,9 +740,9 @@ Obtains WLAN connection information. This API uses an asynchronous callback to r
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information obtained. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the WLAN connection information obtained. If **err** is not **0**, an error has occurred.|
**Example**
```js
@@ -844,9 +844,9 @@ Checks whether the WLAN is connected.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the WLAN is connected; returns **false** otherwise.|
## wifi.getSupportedFeatures7+
@@ -863,24 +863,24 @@ Obtains the features supported by this device.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | number | Feature value. |
+| **Type**| **Description**|
+| -------- | -------- |
+| number | Feature value. |
**Feature IDs**
| Value| Description|
| -------- | -------- |
-| 0x0001 | WLAN infrastructure mode|
-| 0x0002 | 5 GHz feature|
-| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature|
-| 0x0008 | Wi-Fi Direct|
-| 0x0010 | SoftAP|
-| 0x0040 | Wi-Fi AWare|
-| 0x8000 | WLAN AP/STA concurrency|
-| 0x8000000 | WPA3 Personal (WPA-3 SAE)|
-| 0x10000000 | WPA3-Enterprise Suite B |
-| 0x20000000 | Enhanced open feature|
+| 0x0001 | WLAN infrastructure mode. |
+| 0x0002 | 5 GHz feature. |
+| 0x0004 | Generic Advertisement Service (GAS)/Access Network Query Protocol (ANQP) feature. |
+| 0x0008 | Wi-Fi Direct. |
+| 0x0010 | SoftAP. |
+| 0x0040 | Wi-Fi AWare. |
+| 0x8000 | WLAN AP/STA concurrency. |
+| 0x8000000 | WPA3 Personal (WPA-3 SAE). |
+| 0x10000000 | WPA3-Enterprise Suite B. |
+| 0x20000000 | Enhanced open feature. |
## wifi.isFeatureSupported7+
@@ -896,15 +896,15 @@ Checks whether the device supports the specified WLAN feature.
**Parameters**
- | **Name**| **Type**| Mandatory| **Description**|
- | -------- | -------- | -------- | -------- |
- | featureId | number | Yes| Feature ID.|
+| **Name**| **Type**| Mandatory| **Description**|
+| -------- | -------- | -------- | -------- |
+| featureId | number | Yes| Feature ID.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
## wifi.getDeviceMacAddress7+
@@ -921,9 +921,9 @@ Obtains the device MAC address.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | string[] | MAC address obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| string[] | MAC address obtained.|
## wifi.getIpInfo7+
@@ -938,9 +938,9 @@ Obtains IP information.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | [IpInfo](#ipinfo7) | IP information obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| [IpInfo](#ipinfo7) | IP information obtained.|
## IpInfo7+
@@ -972,9 +972,9 @@ Obtains the country code.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | string | Country code obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| string | Country code obtained.|
## wifi.reassociate7+
@@ -991,9 +991,9 @@ Re-associates with the network.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.reconnect7+
@@ -1010,9 +1010,9 @@ Reconnects to the network.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.getDeviceConfigs7+
@@ -1029,9 +1029,9 @@ Obtains network configuration.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Array<[WifiDeviceConfig](#wifideviceconfig)> | Array of network configuration obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Array<[WifiDeviceConfig](#wifideviceconfig)> | Array of network configuration obtained.|
## wifi.updateNetwork7+
@@ -1048,15 +1048,15 @@ Updates network configuration.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiDeviceConfig](#wifideviceconfig) | Yes| New WLAN configuration.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiDeviceConfig](#wifideviceconfig) | Yes| New WLAN configuration.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.|
+| **Type**| **Description**|
+| -------- | -------- |
+| number | ID of the updated network configuration. The value **-1** indicates that the operation has failed.|
## wifi.disableNetwork7+
@@ -1073,15 +1073,15 @@ Disables network configuration.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | netId | number | Yes| ID of the network configuration to disable.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| netId | number | Yes| ID of the network configuration to disable.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.removeAllNetwork7+
@@ -1098,9 +1098,9 @@ Removes the configuration of all networks.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.removeDevice7+
@@ -1117,15 +1117,15 @@ Removes the specified network configuration.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | id | number | Yes| ID of the network configuration to remove.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| id | number | Yes| ID of the network configuration to remove.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.enableHotspot7+
@@ -1142,9 +1142,9 @@ Enables this hotspot.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.disableHotspot7+
@@ -1161,9 +1161,9 @@ Disables this hotspot.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.isHotspotDualBandSupported7+
@@ -1180,9 +1180,9 @@ Checks whether the hotspot supports dual band.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the feature is supported; returns **false** otherwise.|
## wifi.isHotspotActive7+
@@ -1199,9 +1199,9 @@ Checks whether this hotspot is active.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the hotspot is active; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the hotspot is active; returns **false** otherwise.|
## wifi.setHotspotConfig7+
@@ -1218,15 +1218,15 @@ Sets hotspot configuration.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [HotspotConfig](#hotspotconfig7) | Yes| Hotspot configuration to set.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [HotspotConfig](#hotspotconfig7) | Yes| Hotspot configuration to set.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## HotspotConfig7+
@@ -1260,9 +1260,9 @@ obtains hotspot configuration.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | [HotspotConfig](#hotspotconfig7) | Hotspot configuration obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| [HotspotConfig](#hotspotconfig7) | Hotspot configuration obtained.|
## wifi.getStations7+
@@ -1279,9 +1279,9 @@ Obtains information about the connected stations.
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | Array<[StationInfo](#stationinfo7)> | Connected stations obtained.|
+| **Type**| **Description**|
+| -------- | -------- |
+| Array<[StationInfo](#stationinfo7)> | Connected stations obtained.|
## StationInfo7+
@@ -1311,9 +1311,9 @@ Obtains P2P link information. This API uses a promise to return the result.
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Promise used to return the P2P link information obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Promise used to return the P2P link information obtained.|
@@ -1354,9 +1354,9 @@ Obtains P2P link information. This API uses an asynchronous callback to return t
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the P2P link information. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the P2P link information. If **err** is not **0**, an error has occurred.|
## wifi.getCurrentGroup8+
@@ -1371,9 +1371,9 @@ Obtains the current P2P group information. This API uses a promise to return the
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | Promise used to return the group information obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | Promise used to return the group information obtained.|
## wifi.getCurrentGroup8+
@@ -1388,9 +1388,9 @@ Obtains the current P2P group information. This API uses an asynchronous callbac
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
## wifi.getP2pPeerDevices8+
@@ -1405,9 +1405,9 @@ Obtains the peer device list in the P2P connection. This API uses a promise to r
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<[WifiP2pDevice[]](#wifip2pdevice8)> | Promise used to return the peer device list.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[WifiP2pDevice[]](#wifip2pdevice8)> | Promise used to return the peer device list.|
## wifi.getP2pPeerDevices8+
@@ -1422,9 +1422,9 @@ Obtains the peer device list in the P2P connection. This API uses an asynchronou
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list obtained. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the peer device list obtained. If **err** is not **0**, an error has occurred.|
## WifiP2pDevice8+
@@ -1469,9 +1469,9 @@ Obtains the local device information in the P2P connection. This API uses a prom
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<[WifiP2pDevice](#wifip2pdevice8)> | Promise used to return the local device information obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise<[WifiP2pDevice](#wifip2pdevice8)> | Promise used to return the local device information obtained.|
## wifi.getP2pLocalDevice9+
@@ -1486,9 +1486,9 @@ Obtains the local device information in the P2P connection. This API uses an asy
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the local device information obtained. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice8)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the local device information obtained. If **err** is not **0**, an error has occurred.|
## wifi.createGroup8+
@@ -1503,15 +1503,15 @@ Creates a P2P group.
**Parameters**
- | **Name**| **Type**| Mandatory| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiP2PConfig](#wifip2pconfig8) | Yes| Group configuration.|
+| **Name**| **Type**| Mandatory| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiP2PConfig](#wifip2pconfig8) | Yes| Group configuration.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## WifiP2PConfig8+
@@ -1554,9 +1554,9 @@ Removes this P2P group.
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.p2pConnect8+
@@ -1572,15 +1572,15 @@ Sets up a P2P connection.
**Parameters**
- | **Name**| **Type**| Mandatory| **Description**|
- | -------- | -------- | -------- | -------- |
- | config | [WifiP2PConfig](#wifip2pconfig8) | Yes| P2P group configuration.|
+| **Name**| **Type**| Mandatory| **Description**|
+| -------- | -------- | -------- | -------- |
+| config | [WifiP2PConfig](#wifip2pconfig8) | Yes| P2P group configuration.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example**
@@ -1662,9 +1662,9 @@ Cancels this P2P connection.
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.startDiscoverDevices8+
@@ -1679,9 +1679,9 @@ Starts to discover devices.
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.stopDiscoverDevices8+
@@ -1696,9 +1696,9 @@ Stops discovering devices.
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.deletePersistentGroup8+
@@ -1716,15 +1716,15 @@ Deletes a persistent group.
**Parameters**
- | **Name**| **Type**| Mandatory| **Description**|
- | -------- | -------- | -------- | -------- |
- | netId | number | Yes| ID of the group to delete.|
+| **Name**| **Type**| Mandatory| **Description**|
+| -------- | -------- | -------- | -------- |
+| netId | number | Yes| ID of the group to delete.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.getP2pGroups9+
@@ -1741,9 +1741,9 @@ Obtains information about all P2P groups. This API uses a promise to return the
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> > | Promise used to return the group information obtained.|
+| Type| Description|
+| -------- | -------- |
+| Promise< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> > | Promise used to return the group information obtained.|
## WifiP2pGroupInfo8+
@@ -1779,9 +1779,9 @@ Obtains information about all P2P groups. This API uses an asynchronous callback
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the group information obtained. If **err** is not **0**, an error has occurred.|
## wifi.setDeviceName8+
@@ -1798,15 +1798,15 @@ Sets the device name.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | devName | string | Yes| Device name to set.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| devName | string | Yes| Device name to set.|
**Return value**
- | **Type**| **Description**|
- | -------- | -------- |
- | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+| **Type**| **Description**|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## wifi.on('wifiStateChange')7+
@@ -1821,19 +1821,19 @@ Registers the WLAN state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiStateChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the WLAN state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiStateChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the WLAN state.|
**WLAN states**
| **Value**| **Description**|
| -------- | -------- |
-| 0 | Deactivated|
-| 1 | Activated|
-| 2 | Activating|
-| 3 | Deactivating|
+| 0 | Deactivated. |
+| 1 | Activated. |
+| 2 | Activating. |
+| 3 | Deactivating. |
## wifi.off('wifiStateChange')7+
@@ -1848,25 +1848,24 @@ Unregisters the WLAN state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiStateChange**.|
- | callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiStateChange**.|
+| callback | Callback<number> | No| Callback used to return the WLAN state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Example**
```js
import wifi from '@ohos.wifi';
- var WIFI_POWER_STATE = "wifiStateChange";
var recvPowerNotifyFunc = result => {
console.info("Receive power state change event: " + result);
}
// Register an event.
- wifi.on(WIFI_POWER_STATE, recvPowerNotifyFunc);
+ wifi.on("wifiStateChange", recvPowerNotifyFunc);
// Unregister an event.
- wifi.off(WIFI_POWER_STATE, recvPowerNotifyFunc);
+ wifi.off("wifiStateChange", recvPowerNotifyFunc);
```
@@ -1882,17 +1881,17 @@ Registers the WLAN connection state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiConnectionChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the WLAN connection state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the WLAN connection state.|
**WLAN connection states**
| **Value**| **Description**|
| -------- | -------- |
-| 0 | Disconnected|
-| 1 | Connected|
+| 0 | Disconnected.|
+| 1 | Connected.|
## wifi.off('wifiConnectionChange')7+
@@ -1907,10 +1906,10 @@ Unregisters the WLAN connection state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiConnectionChange**.|
- | callback | Callback<number> | No| Callback used to return the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiConnectionChange**.|
+| callback | Callback<number> | No| Callback used to return the WLAN connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('wifiScanStateChange')7+
@@ -1925,17 +1924,17 @@ Registers the WLAN scan state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiScanStateChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the WLAN scan state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiScanStateChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the WLAN scan state.|
**WLAN scan states**
| **Value**| **Description**|
| -------- | -------- |
-| 0 | Scan failed|
-| 1 | Scan successful|
+| 0 | Scan failed.|
+| 1 | Scan successful.|
## wifi.off('wifiScanStateChange')7+
@@ -1968,10 +1967,10 @@ Registers the RSSI change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiRssiChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the RSSI, in dBm.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiRssiChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the RSSI, in dBm.|
## wifi.off('wifiRssiChange')7+
@@ -1986,10 +1985,10 @@ Unregisters the RSSI change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **wifiRssiChange**.|
- | callback | Callback<number> | No| Callback used to return the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **wifiRssiChange**.|
+| callback | Callback<number> | No| Callback used to return the RSSI. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('hotspotStateChange')7+
@@ -2004,19 +2003,19 @@ Registers the hotspot state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **hotspotStateChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the hotspot state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **hotspotStateChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the hotspot state.|
**Hotspot states**
| **Value**| **Description**|
| -------- | -------- |
-| 0 | Deactivated|
-| 1 | Activated|
-| 2 | Activating|
-| 3 | Deactivating|
+| 0 | Deactivated. |
+| 1 | Activated. |
+| 2 | Activating. |
+| 3 | Deactivating. |
## wifi.off('hotspotStateChange')7+
@@ -2031,10 +2030,10 @@ Unregisters the hotspot state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **hotspotStateChange**.|
- | callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **hotspotStateChange**.|
+| callback | Callback<number> | No| Callback used to return the hotspot state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pStateChange')8+
@@ -2049,20 +2048,20 @@ Registers the P2P state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pStateChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the P2P state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pStateChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the P2P state.|
**P2P states**
| **Value**| **Description**|
| -------- | -------- |
-| 1 | Available|
-| 2 | Opening|
-| 3 | Opened|
-| 4 | Closing|
-| 5 | Closed|
+| 1 | Available. |
+| 2 | Opening. |
+| 3 | Opened. |
+| 4 | Closing. |
+| 5 | Closed. |
## wifi.off('p2pStateChange')8+
@@ -2076,10 +2075,10 @@ Unregisters the P2P state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pStateChange**.|
- | callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pStateChange**.|
+| callback | Callback<number> | No| Callback used to return the P2P state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pConnectionChange')8+
@@ -2094,10 +2093,10 @@ Registers the P2P connection state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
- | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Yes| Callback invoked to return the P2P connection state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
+| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Yes| Callback invoked to return the P2P connection state.|
## wifi.off('p2pConnectionChange')8+
@@ -2112,10 +2111,10 @@ Unregisters the P2P connection state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pConnectionChange**.|
- | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pConnectionChange**.|
+| callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | No| Callback used to return the P2P connection state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pDeviceChange')8+
@@ -2130,10 +2129,10 @@ Registers the P2P device state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
- | callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | Yes| Callback invoked to return the P2P device state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
+| callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | Yes| Callback invoked to return the P2P device state.|
## wifi.off('p2pDeviceChange')8+
@@ -2148,10 +2147,10 @@ Unregisters the P2P device state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pDeviceChange**.|
- | callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pDeviceChange**.|
+| callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | No| Callback used to return the P2P device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pPeerDeviceChange')8+
@@ -2166,10 +2165,10 @@ Registers the P2P peer device state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
- | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | Yes| Callback invoked to return the P2P peer device state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
+| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | Yes| Callback invoked to return the P2P peer device state.|
## wifi.off('p2pPeerDeviceChange')8+
@@ -2184,10 +2183,10 @@ Unregisters the P2P peer device state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
- | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | No| Callback used to return the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
+| callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | No| Callback used to return the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pPersistentGroupChange')8+
@@ -2202,10 +2201,10 @@ Registers the P2P persistent group state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
- | callback | Callback<void> | Yes| Callback invoked to return the P2P persistent group state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
+| callback | Callback<void> | Yes| Callback invoked to return the P2P persistent group state.|
## wifi.off('p2pPersistentGroupChange')8+
@@ -2220,10 +2219,10 @@ Unregisters the P2P persistent group state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
- | callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pPersistentGroupChange**.|
+| callback | Callback<void> | No| Callback used to return the P2P persistent group state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
## wifi.on('p2pDiscoveryChange')8+
@@ -2238,17 +2237,17 @@ Registers the P2P device discovery state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
- | callback | Callback<number> | Yes| Callback invoked to return the P2P device discovery state.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
+| callback | Callback<number> | Yes| Callback invoked to return the P2P device discovery state.|
**P2P discovered device states**
| **Value**| **Description**|
| -------- | -------- |
-| 0 | Initial state|
-| 1 | Discovered|
+| 0 | Initial state.|
+| 1 | Discovered.|
## wifi.off('p2pDiscoveryChange')8+
@@ -2263,7 +2262,7 @@ Unregisters the P2P device discovery state change events.
**Parameters**
- | **Name**| **Type**| **Mandatory**| **Description**|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
- | callback | Callback<number> | No| Callback used to return the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
+| **Name**| **Type**| **Mandatory**| **Description**|
+| -------- | -------- | -------- | -------- |
+| type | string | Yes| Event type. The value is **p2pDiscoveryChange**.|
+| callback | Callback<number> | No| Callback used to return the P2P device discovery state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
diff --git a/en/application-dev/reference/apis/js-apis-wifiext.md b/en/application-dev/reference/apis/js-apis-wifiext.md
index e421081e97a52ec917050bbfee15dda5e0c6c74a..9ce53d76e2517eb199067f779168fb9fe9d8b032 100644
--- a/en/application-dev/reference/apis/js-apis-wifiext.md
+++ b/en/application-dev/reference/apis/js-apis-wifiext.md
@@ -23,6 +23,7 @@ Enables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
+
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
@@ -39,6 +40,7 @@ Disables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
+
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
@@ -55,6 +57,7 @@ Obtains the supported power models. This API uses a promise to return the result
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
+
| Type| Description|
| -------- | -------- |
| Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.|
@@ -84,6 +87,7 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[PowerModel](#powermodel)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
@@ -100,6 +104,7 @@ Obtains the power model. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
+
| Type| Description|
| -------- | -------- |
| Promise<[PowerModel](#powermodel)> | Promise used to return the power model obtained.|
@@ -116,6 +121,7 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<[PowerModel](#powermodel)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.|
@@ -132,11 +138,13 @@ setPowerModel(model: PowerModel) : boolean;
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | AsyncCallback<[PowerModel](#powermodel)> | Yes| Power model to set.|
**Return value**
+
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md
index c30f11c4a06a5b80ae2f00f88a5baa8e071ffad3..91c284004f4b1e2f22d46ba27c3249d9b05dd5bb 100644
--- a/en/application-dev/reference/apis/js-apis-window.md
+++ b/en/application-dev/reference/apis/js-apis-window.md
@@ -303,8 +303,8 @@ Creates a subwindow. This API uses an asynchronous callback to return the result
**Example**
```js
-var windowClass = null;
-window.create("first", window.WindowType.TYPE_APP,(err,data) => {
+let windowClass = null;
+window.create('first', window.WindowType.TYPE_APP,(err,data) => {
if(err.code){
console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err));
return;
@@ -340,8 +340,8 @@ Creates a subwindow. This API uses a promise to return the result.
**Example**
```js
-var windowClass = null;
-let promise = window.create("first", window.WindowType.TYPE_APP);
+let windowClass = null;
+let promise = window.create('first', window.WindowType.TYPE_APP);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the subWindow. Data: ' + JSON.stringify(data));
@@ -370,8 +370,8 @@ Creates a subwindow (in API version 8) or a system window (from API version 9).
**Example**
```js
-var windowClass = null;
- window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
+let windowClass = null;
+ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT, (err, data) => {
if (err.code) {
console.error('Failed to create the window. Cause: ' + JSON.stringify(err));
return;
@@ -407,8 +407,8 @@ Creates a subwindow (in API version 8) or a system window (from API version 9).
**Example**
```js
-var windowClass = null;
-let promise = window.create(this.context, "alertWindow", window.WindowType.TYPE_SYSTEM_ALERT);
+let windowClass = null;
+let promise = window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the window. Data:' + JSON.stringify(data));
@@ -435,8 +435,8 @@ Finds a window based on the ID. This API uses an asynchronous callback to return
**Example**
```js
-var windowClass = null;
- window.find("alertWindow", (err, data) => {
+let windowClass = null;
+ window.find('alertWindow', (err, data) => {
if (err.code) {
console.error('Failed to find the Window. Cause: ' + JSON.stringify(err));
return;
@@ -469,8 +469,8 @@ Finds a window based on the ID. This API uses a promise to return the result.
**Example**
```js
-var windowClass = null;
-let promise = window.find("alertWindow");
+let windowClass = null;
+let promise = window.find('alertWindow');
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in finding the window. Data: ' + JSON.stringify(data));
@@ -498,7 +498,7 @@ Obtains the top window of the current application. This API uses an asynchronous
**Example**
```js
-var windowClass = null;
+let windowClass = null;
window.getTopWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
@@ -528,7 +528,7 @@ Obtains the top window of the current application. This API uses a promise to re
**Example**
```js
-var windowClass = null;
+let windowClass = null;
let promise = window.getTopWindow();
promise.then((data)=> {
windowClass = data;
@@ -556,7 +556,7 @@ Obtains the top window of the current application. This API uses an asynchronous
**Example**
```js
-var windowClass = null;
+let windowClass = null;
window.getTopWindow(this.context, (err, data) => {
if (err.code) {
console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err));
@@ -590,7 +590,7 @@ Obtains the top window of the current application. This API uses a promise to re
**Example**
```js
-var windowClass = null;
+let windowClass = null;
let promise = window.getTopWindow(this.context);
promise.then((data)=> {
windowClass = data;
@@ -622,7 +622,7 @@ Minimizes all windows on a display. This API uses an asynchronous callback to re
import display from '@ohos.display'
import window from '@ohos.window'
-var displayClass = null;
+let displayClass = null;
display.getDefaultDisplay((err, data) => {
if(err.code) {
return;
@@ -665,7 +665,7 @@ Minimizes all windows on a display. This API uses a promise to return the result
import display from '@ohos.display'
import window from '@ohos.window'
-var displayClass = null;
+let displayClass = null;
display.getDefaultDisplay((err, data) => {
if(err.code) {
return;
@@ -1255,7 +1255,7 @@ Sets the type of this window. This API uses an asynchronous callback to return t
**Example**
```js
-var type = window.WindowType.TYPE_APP;
+let type = window.WindowType.TYPE_APP;
windowClass.setWindowType(type, (err, data) => {
if (err.code) {
console.error('Failed to set the window type. Cause: ' + JSON.stringify(err));
@@ -1294,7 +1294,7 @@ Sets the type of this window. This API uses a promise to return the result.
**Example**
```js
-var type = window.WindowType.TYPE_APP;
+let type = window.WindowType.TYPE_APP;
let promise = windowClass.setWindowType(type);
promise.then((data)=> {
console.info('Succeeded in setting the window type. Data: ' + JSON.stringify(data));
@@ -1372,7 +1372,7 @@ Obtains the area where this window cannot be displayed, for example, the system
**Example**
```js
-var type = window.AvoidAreaType.TYPE_SYSTEM;
+let type = window.AvoidAreaType.TYPE_SYSTEM;
windowClass.getAvoidArea(type, (err, data) => {
if (err.code) {
console.error('Failed to obtain the area. Cause:' + JSON.stringify(err));
@@ -1405,7 +1405,7 @@ Obtains the area where this window cannot be displayed, for example, the system
**Example**
```js
-var type = window.AvoidAreaType.TYPE_SYSTEM;
+let type = window.AvoidAreaType.TYPE_SYSTEM;
let promise = windowClass.getAvoidArea(type);
promise.then((data)=> {
console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data));
@@ -1432,7 +1432,7 @@ Sets whether to enable the full-screen mode for this window. This API uses an as
**Example**
```js
-var isFullScreen = true;
+let isFullScreen = true;
windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) {
console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err));
@@ -1465,7 +1465,7 @@ Sets whether to enable the full-screen mode for this window. This API uses a pro
**Example**
```js
-var isFullScreen = true;
+let isFullScreen = true;
let promise = windowClass.setFullScreen(isFullScreen);
promise.then((data)=> {
console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data));
@@ -1492,7 +1492,7 @@ Sets whether to enable the full-screen mode for the window layout. This API uses
**Example**
```js
-var isLayoutFullScreen= true;
+let isLayoutFullScreen= true;
windowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => {
if (err.code) {
console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err));
@@ -1525,7 +1525,7 @@ Sets whether to enable the full-screen mode for the window layout. This API uses
**Example**
```js
-var isLayoutFullScreen = true;
+let isLayoutFullScreen = true;
let promise = windowClass.setLayoutFullScreen(isLayoutFullScreen);
promise.then((data)=> {
console.info('Succeeded in setting the window layout to full-screen mode. Data: ' + JSON.stringify(data));
@@ -1546,14 +1546,14 @@ Sets whether to display the status bar and navigation bar in this window. This A
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to `["status", "navigation"]`. By default, they are not displayed.|
+| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to `['status', 'navigation']`. By default, they are not displayed.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
```js
// In this example, the status bar and navigation bar are not displayed.
-var names = [];
+let names = [];
windowClass.setSystemBarEnable(names, (err, data) => {
if (err.code) {
console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err));
@@ -1575,7 +1575,7 @@ Sets whether to display the status bar and navigation bar in this window. This A
| Name| Type | Mandatory| Description |
| ------ | ----- | ---- | ------------------------------------------------------------ |
-| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to `["status", "navigation"]`. By default, they are not displayed.|
+| names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to `['status', 'navigation']`. By default, they are not displayed.|
**Return value**
@@ -1587,7 +1587,7 @@ Sets whether to display the status bar and navigation bar in this window. This A
```js
// In this example, the status bar and navigation bar are not displayed.
-var names = [];
+let names = [];
let promise = windowClass.setSystemBarEnable(names);
promise.then((data)=> {
console.info('Succeeded in setting the system bar to be invisible. Data: ' + JSON.stringify(data));
@@ -1614,7 +1614,7 @@ Sets the properties of the status bar and navigation bar in this window. This AP
**Example**
```js
-var SystemBarProperties={
+let SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
// The following properties are supported since API version 7.
@@ -1656,7 +1656,7 @@ Sets the properties of the status bar and navigation bar in this window. This AP
**Example**
```js
-var SystemBarProperties={
+let SystemBarProperties={
statusBarColor: '#ff00ff',
navigationBarColor: '#00ff00',
// The following properties are supported since API version 7.
@@ -1692,7 +1692,7 @@ Sets the preferred orientation for this window. This API uses an asynchronous ca
**Example**
```js
-var orientation = window.Orientation.AUTO_ROTATION;
+let orientation = window.Orientation.AUTO_ROTATION;
windowClass.setPreferredOrientation(orientation, (err, data) => {
if (err.code) {
console.error('Failed to set window orientation. Cause: ' + JSON.stringify(err));
@@ -1725,7 +1725,7 @@ Sets the preferred orientation for this window. This API uses a promise to retur
**Example**
```js
-var orientation = window.Orientation.AUTO_ROTATION;
+let orientation = window.Orientation.AUTO_ROTATION;
let promise = windowClass.setPreferredOrientation(orientation);
promise.then((data)=> {
console.info('Succeeded in setting the window orientation. Data: ' + JSON.stringify(data));
@@ -1752,7 +1752,7 @@ Loads content from a page to this window. This API uses an asynchronous callback
**Example**
```js
-windowClass.loadContent("pages/page2/page2", (err, data) => {
+windowClass.loadContent('pages/page2/page2', (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -1784,7 +1784,7 @@ Loads content from a page to this window. This API uses a promise to return the
**Example**
```js
-let promise = windowClass.loadContent("pages/page2/page2");
+let promise = windowClass.loadContent('pages/page2/page2');
promise.then((data)=> {
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
}).catch((err)=>{
@@ -1816,9 +1816,9 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2",this.storage,(err, data) => {
+ windowStage.loadContent('pages/page2',this.storage,(err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -1859,10 +1859,10 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.loadContent("pages/page2",this.storage);
+ let windowClass = null;
+ let promise = windowStage.loadContent('pages/page2',this.storage);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
@@ -2195,7 +2195,7 @@ Unsubscribes from screenshot events.
**Example**
```js
-var callback = ()=>{
+let callback = ()=>{
console.info('screenshot happened');
}
windowClass.on('screenshot', callback)
@@ -2272,7 +2272,7 @@ Binds the modal window to the target window, and adds a callback to listen for m
```js
class MyDeathRecipient {
onRemoteDied() {
- console.log("server died");
+ console.log('server died');
}
}
class TestRemoteObject extends rpc.RemoteObject {
@@ -2289,7 +2289,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return false;
}
}
-let token = new TestRemoteObject("testObject");
+let token = new TestRemoteObject('testObject');
windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.');
}, (err, data) => {
@@ -2329,7 +2329,7 @@ Binds the modal window to the target window, and adds a callback to listen for m
```js
class MyDeathRecipient {
onRemoteDied() {
- console.log("server died");
+ console.log('server died');
}
}
class TestRemoteObject extends rpc.RemoteObject {
@@ -2346,7 +2346,7 @@ class TestRemoteObject extends rpc.RemoteObject {
return false;
}
}
-let token = new TestRemoteObject("testObject");
+let token = new TestRemoteObject('testObject');
let promise = windowClass.bindDialogTarget(token, () => {
console.info('Dialog Window Need Destroy.');
});
@@ -2535,7 +2535,7 @@ Sets the background color for this window. This API uses an asynchronous callbac
**Example**
```js
-var color = '#00ff33';
+let color = '#00ff33';
windowClass.setBackgroundColor(color, (err, data) => {
if (err.code) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(err));
@@ -2568,7 +2568,7 @@ Sets the background color for this window. This API uses a promise to return the
**Example**
```js
-var color = '#00ff33';
+let color = '#00ff33';
let promise = windowClass.setBackgroundColor(color);
promise.then((data)=> {
console.info('Succeeded in setting the background color. Data: ' + JSON.stringify(data));
@@ -2596,7 +2596,7 @@ Wakes up the screen.
**Example**
```js
-var wakeUp = true;
+let wakeUp = true;
windowClass.setWakeUpScreen(wakeUp);
```
@@ -2618,7 +2618,7 @@ Sets the screen brightness for this window. This API uses an asynchronous callba
**Example**
```js
-var brightness = 1;
+let brightness = 1;
windowClass.setBrightness(brightness, (err, data) => {
if (err.code) {
console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err));
@@ -2651,7 +2651,7 @@ Sets the screen brightness for this window. This API uses a promise to return th
**Example**
```js
-var brightness = 1;
+let brightness = 1;
let promise = windowClass.setBrightness(brightness);
promise.then((data)=> {
console.info('Succeeded in setting the brightness. Data: ' + JSON.stringify(data));
@@ -2748,7 +2748,7 @@ Sets whether this window can gain focus. This API uses an asynchronous callback
**Example**
```js
-var isFocusable= true;
+let isFocusable= true;
windowClass.setFocusable(isFocusable, (err, data) => {
if (err.code) {
console.error('Failed to set the window to be focusable. Cause:' + JSON.stringify(err));
@@ -2781,7 +2781,7 @@ Sets whether this window can gain focus. This API uses a promise to return the r
**Example**
```js
-var isFocusable= true;
+let isFocusable= true;
let promise = windowClass.setFocusable(isFocusable);
promise.then((data)=> {
console.info('Succeeded in setting the window to be focusable. Data: ' + JSON.stringify(data));
@@ -2808,7 +2808,7 @@ Sets whether to keep the screen always on. This API uses an asynchronous callbac
**Example**
```js
-var isKeepScreenOn = true;
+let isKeepScreenOn = true;
windowClass.setKeepScreenOn(isKeepScreenOn, (err, data) => {
if (err.code) {
console.error('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err));
@@ -2841,7 +2841,7 @@ Sets whether to keep the screen always on. This API uses a promise to return the
**Example**
```js
-var isKeepScreenOn = true;
+let isKeepScreenOn = true;
let promise = windowClass.setKeepScreenOn(isKeepScreenOn);
promise.then((data) => {
console.info('Succeeded in setting the screen to be always on. Data: ' + JSON.stringify(data));
@@ -2938,7 +2938,7 @@ Sets whether this window is in privacy mode. This API uses an asynchronous callb
**Example**
```js
-var isPrivacyMode = true;
+let isPrivacyMode = true;
windowClass.setPrivacyMode(isPrivacyMode, (err, data) => {
if (err.code) {
console.error('Failed to set the window to privacy mode. Cause:' + JSON.stringify(err));
@@ -2972,7 +2972,7 @@ Sets whether this window is in privacy mode. This API uses a promise to return t
**Example**
```js
-var isPrivacyMode = true;
+let isPrivacyMode = true;
let promise = windowClass.setPrivacyMode(isPrivacyMode);
promise.then((data)=> {
console.info('Succeeded in setting the window to privacy mode. Data: ' + JSON.stringify(data));
@@ -2996,7 +2996,7 @@ Sets whether to ignore this window during screen capturing or recording.
| ------------- | ------- | ---- | -------------------- |
| isSkip | boolean | Yes | Whether to ignore the window. The default value is `false`. The value `true` means that the window is ignored, and `false` means the opposite. |
```js
-var isSkip = true;
+let isSkip = true;
windowClass.setSnapshotSkip(isSkip);
```
@@ -3018,7 +3018,7 @@ Sets whether this window is touchable. This API uses an asynchronous callback to
**Example**
```js
-var isTouchable = true;
+let isTouchable = true;
windowClass.setTouchable(isTouchable, (err, data) => {
if (err.code) {
console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err));
@@ -3052,7 +3052,7 @@ Sets whether this window is touchable. This API uses a promise to return the res
**Example**
```js
-var isTouchable = true;
+let isTouchable = true;
let promise = windowClass.setTouchable(isTouchable);
promise.then((data)=> {
console.info('Succeeded in setting the window to be touchable. Data: ' + JSON.stringify(data));
@@ -3081,7 +3081,7 @@ Sets whether this window is forbidden to move in split-screen mode. This API use
**Example**
```js
-var isForbidSplitMove = true;
+let isForbidSplitMove = true;
windowClass.setForbidSplitMove(isForbidSplitMove, (err, data) => {
if (err.code) {
console.error('Failed to forbid window moving in split screen mode. Cause:' + JSON.stringify(err));
@@ -3117,7 +3117,7 @@ Sets whether this window is forbidden to move in split-screen mode. This API use
**Example**
```js
-var isForbidSplitMove = true;
+let isForbidSplitMove = true;
let promise = windowClass.setForbidSplitMove(isForbidSplitMove);
promise.then((data)=> {
console.info('Succeeded in forbidding window moving in split screen mode. Data: ' + JSON.stringify(data));
@@ -3333,7 +3333,7 @@ Sets the scale parameters for this window.
**Example**
```js
-var obj : window.ScaleOptions = {
+let obj : window.ScaleOptions = {
x : 2.0,
y : 1.0,
pivotX = 0.5;
@@ -3361,7 +3361,7 @@ Sets the rotation parameters for this window.
**Example**
```js
-var obj : window.RotateOptions = {
+let obj : window.RotateOptions = {
x : 1.0,
y : 1.0,
z : 45.0,
@@ -3390,7 +3390,7 @@ Sets the translation parameters for this window.
**Example**
```js
-var obj : window.TranslateOptions = {
+let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -3431,7 +3431,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -3495,7 +3495,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
windowStage.getMainWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
@@ -3530,7 +3530,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
let promise = windowStage.getMainWindow();
promise.then((data)=> {
windowClass = data;
@@ -3565,8 +3565,8 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
- windowStage.createSubWindow("mySubWindow", (err, data) => {
+ let windowClass = null;
+ windowStage.createSubWindow('mySubWindow', (err, data) => {
if (err.code) {
console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err));
return;
@@ -3607,8 +3607,8 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.createSubWindow("mySubWindow");
+ let windowClass = null;
+ let promise = windowStage.createSubWindow('mySubWindow');
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
@@ -3641,7 +3641,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
windowStage.getSubWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the subwindow. Cause: ' + JSON.stringify(err));
@@ -3676,7 +3676,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- var windowClass = null;
+ let windowClass = null;
let promise = windowStage.getSubWindow();
promise.then((data)=> {
windowClass = data;
@@ -3713,9 +3713,9 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2",this.storage,(err, data) => {
+ windowStage.loadContent('pages/page2',this.storage,(err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -3757,10 +3757,10 @@ class myAbility extends Ability {
storage : LocalStorage
onWindowStageCreate(windowStage) {
this.storage = new LocalStorage();
- this.storage.setOrCreate("storageSimpleProp",121);
+ this.storage.setOrCreate('storageSimpleProp',121);
console.log('onWindowStageCreate');
- var windowClass = null;
- let promise = windowStage.loadContent("pages/page2",this.storage);
+ let windowClass = null;
+ let promise = windowStage.loadContent('pages/page2',this.storage);
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
@@ -3795,7 +3795,7 @@ import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
- windowStage.loadContent("pages/page2", (err, data) => {
+ windowStage.loadContent('pages/page2', (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
@@ -3963,7 +3963,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
iterations: 1, // Number of playback times.
playMode: PlayMode.Normal // Animation playback mode.
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -4014,7 +4014,7 @@ controller.animationForShown = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
@@ -4060,7 +4060,7 @@ controller.animationForHidden = (context : window.TransitionContext) => {
context.completeTransition(true)
}
}, () => {
- var obj : window.TranslateOptions = {
+ let obj : window.TranslateOptions = {
x : 100.0,
y : 0.0,
z : 0.0
diff --git a/en/application-dev/reference/apis/js-apis-windowAnimationManager.md b/en/application-dev/reference/apis/js-apis-windowAnimationManager.md
index fd9bb9e2d7e174e221c54fdefeedcff3473ff405..248e4977d5b215d20a67373e9608c3f6ae1588bb 100644
--- a/en/application-dev/reference/apis/js-apis-windowAnimationManager.md
+++ b/en/application-dev/reference/apis/js-apis-windowAnimationManager.md
@@ -2,7 +2,6 @@
The **WindowAnimationManager** module provides APIs to listen for application start/exit events and window minimization/maximization events and associate animations with these events.
> **NOTE**
->
> The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
@@ -32,7 +31,7 @@ Before using other APIs of **windowAnimationManager**, you must call this API to
**Example**
```js
-var controller = {
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
@@ -89,8 +88,8 @@ Minimizes the window that displays the animation. This API uses an asynchronous
**Example**
```js
-var target: WindowAnimationTarget = undefined;
-var controller = {
+let target: WindowAnimationTarget = undefined;
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
@@ -128,7 +127,7 @@ var controller = {
windowAnimationManager.setController(controller)
-var finishedCallback = null;
+let finishedCallback = null;
windowAnimationManager.minimizeWindowWithAnimation(target, (err, data) => {
if (err.code) {
console.error('Failed to minimize the window target. Cause: ' + JSON.stringify(err));
@@ -165,8 +164,8 @@ Minimizes the window that displays the animation. This API uses a promise to ret
**Example**
```js
-var target: WindowAnimationTarget = undefined;
-var controller = {
+let target: WindowAnimationTarget = undefined;
+let controller = {
onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void {
console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget);
finishCallback.onAnimationFinish();
diff --git a/en/application-dev/reference/apis/js-apis-xml.md b/en/application-dev/reference/apis/js-apis-xml.md
index 078c1dc0009329300ab7458a7672b63c76271f61..322a8000a525eef6e32174a2a099f04573570edc 100644
--- a/en/application-dev/reference/apis/js-apis-xml.md
+++ b/en/application-dev/reference/apis/js-apis-xml.md
@@ -339,8 +339,8 @@ let strXml =
let arrayBuffer = new ArrayBuffer(strXml.length);
let bufView = new Uint8Array(arrayBuffer);
let strLen = strXml.length;
-for (var i = 0; i < strLen; ++i) {
- bufView[i] = strXml.charCodeAt(i);
+for (var tmp = 0; tmp < strLen; ++tmp) {
+ bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let arrTag = {};
diff --git a/en/application-dev/reference/arkui-js/js-components-basic-input.md b/en/application-dev/reference/arkui-js/js-components-basic-input.md
index 066da49683ce647db66b9c8cdecd551550b23844..2ce4c7d3b07a6e8dbdcd47c4d3143ec8e4b285df 100644
--- a/en/application-dev/reference/arkui-js/js-components-basic-input.md
+++ b/en/application-dev/reference/arkui-js/js-components-basic-input.md
@@ -20,44 +20,44 @@ Not supported
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
-| Name | Type | Default Value | Mandatory | Description |
-| -------------------------------- | ----------------------- | --------- | ---- | ---------------------------------------- |
-| type | string | text | No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**. The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified. The **button**, **checkbox**, and **radio** types cannot be dynamically modified. - **button**: a button that can be clicked. - **checkbox**: a check box. - **radio**: a radio button that allows users to select one from multiple others with the same name. - **text**: a single-line text field. - **email**: a field used for an email address. - **date**: date component, including the year, month, and day, but excluding time. - **time**: time component, without the time zone. - **number**: field for entering digits. - **password**: password field, in which characters will be shielded.|
-| checked | boolean | false | No | Whether the **\** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. |
-| name | string | - | No | Name of the **\** component. This attribute is mandatory when **type** is set to **radio**. |
-| value | string | - | No | Value of the **\** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name.|
-| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text** \|email\|date\|time\|number\|**password**.|
-| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit. |
-| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated. Available values include: - default - next - go - done - send - search Except for the **next** type, clicking the Enter key hides the soft keyboard.|
-| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG.|
-| showcounter5+ | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. |
-| menuoptions5+ | Array<MeunOption> | - | No | Menu options displayed after users click the **More** button. |
-| autofocus6+ | boolean | false | No | Whether to automatically obtain focus. This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**.|
-| selectedstart6+ | number | -1 | No | Start position for text selection. |
-| selectedend6+ | number | -1 | No | End position for text selection. |
-| softkeyboardenabled6+ | boolean | true | No | Whether to display the soft keyboard during editing. |
-| showpasswordicon6+ | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. |
+| Name | Type | Default Value | Mandatory | Description |
+| -------------------------------- | ----------------------- | ------------- | --------- | ---------------------------------------- |
+| type | string | text | No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**. The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified. The **button**, **checkbox**, and **radio** types cannot be dynamically modified. - **button**: a button that can be clicked. - **checkbox**: a check box. - **radio**: a radio button that allows users to select one from multiple others with the same name. - **text**: a single-line text field. - **email**: a field used for an email address. - **date**: date component, including the year, month, and day, but excluding time. - **time**: time component, without the time zone. - **number**: field for entering digits. - **password**: password field, in which characters will be shielded. |
+| checked | boolean | false | No | Whether the **\** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. |
+| name | string | - | No | Name of the **\** component. This attribute is mandatory when **type** is set to **radio**. |
+| value | string | - | No | Value of the **\** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name. |
+| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text** \|email\|date\|time\|number\|**password**. |
+| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit. |
+| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated. Available values include: - default - next - go - done - send - search Except for the **next** type, clicking the Enter key hides the soft keyboard. |
+| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG. |
+| showcounter5+ | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. |
+| menuoptions5+ | Array<MenuOption> | - | No | Menu options displayed after users click the **More** button. |
+| autofocus6+ | boolean | false | No | Whether to automatically obtain focus. This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**. |
+| selectedstart6+ | number | -1 | No | Start position for text selection. |
+| selectedend6+ | number | -1 | No | End position for text selection. |
+| softkeyboardenabled6+ | boolean | true | No | Whether to display the soft keyboard during editing. |
+| showpasswordicon6+ | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. |
**Table 1** MenuOption5+
-| Name | Type | Description |
-| ------- | ------ | ----------- |
-| icon | string | Path of the icon for a menu option.|
-| content | string | Text content of a menu option.|
+| Name | Type | Description |
+| ------- | ------ | ----------------------------------- |
+| icon | string | Path of the icon for a menu option. |
+| content | string | Text content of a menu option. |
## Styles
In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported.
-| Name | Type | Default Value | Mandatory | Description |
-| ------------------------ | -------------------------- | ---------- | ---- | ---------------------------------------- |
-| color | <color> | \#e6000000 | No | Font color of the single-line text box or button. |
-| font-size | <length> | 16px | No | Font size of the single-line text box or button. |
-| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings. If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.|
-| placeholder-color | <color> | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available only when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
-| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\**](../arkui-js/js-components-basic-text.md) component. |
-| caret-color6+ | <color> | - | No | Color of the caret. |
+| Name | Type | Default Value | Mandatory | Description |
+| ------------------------ | ---------------- | ------------- | --------- | ---------------------------------------- |
+| color | <color> | \#e6000000 | No | Font color of the single-line text box or button. |
+| font-size | <length> | 16px | No | Font size of the single-line text box or button. |
+| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings. If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart. |
+| placeholder-color | <color> | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available only when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
+| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\**](../arkui-js/js-components-basic-text.md) component. |
+| caret-color6+ | <color> | - | No | Color of the caret. |
## Events
@@ -65,31 +65,31 @@ In addition to the [universal styles](../arkui-js/js-components-common-styles.md
In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported.
- When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported.
-
- | Name | Parameter | Description |
+
+ | Name | Parameter | Description |
| ------------------------- | ---------------------------------------- | ---------------------------------------- |
- | change | { value: inputValue } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned. If you change the **value** attribute directly, this event will not be triggered.|
- | enterkeyclick | { value: enterKey } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows: - **2**: returned if **enterkeytype** is **go**. - **3**: returned if **enterkeytype** is **search**. - **4**: returned if **enterkeytype** is **send**. - **5**: returned if **enterkeytype** is **next**. - **6**: returned if **enterkeytype** is **default**, **done**, or is not set.|
- | translate5+ | { value: selectedText } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned.|
- | share5+ | { value: selectedText } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned.|
- | search5+ | { value: selectedText } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned.|
- | optionselect5+ | { index: optionIndex, value: selectedText } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned.|
- | selectchange6+ | { start: number, end: number } | Triggered when the text selection changes. |
+ | change | { value: inputValue } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned. If you change the **value** attribute directly, this event will not be triggered. |
+ | enterkeyclick | { value: enterKey } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows: - **2**: returned if **enterkeytype** is **go**. - **3**: returned if **enterkeytype** is **search**. - **4**: returned if **enterkeytype** is **send**. - **5**: returned if **enterkeytype** is **next**. - **6**: returned if **enterkeytype** is **default**, **done**, or is not set. |
+ | translate5+ | { value: selectedText } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned. |
+ | share5+ | { value: selectedText } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned. |
+ | search5+ | { value: selectedText } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned. |
+ | optionselect5+ | { index: optionIndex, value: selectedText } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned. |
+ | selectchange6+ | { start: number, end: number } | Triggered when the text selection changes. |
- When **type** is set to **checkbox** or **radio**, the following events are supported.
-
- | Name | Parameter | Description |
- | ------ | ---------------------------------------- | ---------------------------------------- |
- | change | { checked:true \| false } | Triggered when the checked status of the **checkbox** or **radio** button changes.|
+
+ | Name | Parameter | Description |
+ | ------ | --------------------------------- | ---------------------------------------- |
+ | change | { checked:true \| false } | Triggered when the checked status of the **checkbox** or **radio** button changes. |
## Methods
In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported.
-| Name | Parameter | Description |
+| Name | Parameter | Description |
| ------------------- | ---------------------------------------- | ---------------------------------------- |
-| focus | { focus: true\|false }: If **focus** is not passed, the default value **true** is used.| Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the input method can be displayed or collapsed. |
-| showError | { error: string } | Displays the error message. This method is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
+| focus | { focus: true\|false }: If **focus** is not passed, the default value **true** is used. | Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the input method can be displayed or collapsed. |
+| showError | { error: string } | Displays the error message. This method is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
| delete6+ | - | Deletes text based on the current caret position when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**; deletes the last character and displays the caret if the current input component does not have a caret. |
## Example
diff --git a/en/application-dev/reference/arkui-js/js-components-media-video.md b/en/application-dev/reference/arkui-js/js-components-media-video.md
index 18c3fbef3bff790dfea6359d7a5d7c5516d0ecd5..c024cbe0058093b754c98f04f579b1cd7dac620f 100644
--- a/en/application-dev/reference/arkui-js/js-components-media-video.md
+++ b/en/application-dev/reference/arkui-js/js-components-media-video.md
@@ -3,17 +3,17 @@
> **NOTE**
>
-> - This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
+> - This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
>
-> - Set **configChanges** under **abilities** in the **config.json** file to **orientation**.
-> ```
-> "abilities": [
-> {
-> "configChanges": ["orientation"],
-> ...
-> }
-> ]
-> ```
+> - Set **configChanges** under **abilities** in the **config.json** file to **orientation**.
+> ```
+> "abilities": [
+> {
+> "configChanges": ["orientation"],
+> ...
+> }
+> ]
+> ```
The **\