Standard system
@@ -60,6 +60,7 @@ OpenHarmony provides the following two types of Docker environments for you to q
+
## Preparations
Before using the Docker environment, perform the following operations:
@@ -77,12 +78,10 @@ The Docker image of OpenHarmony is hosted on [HUAWEI CLOUD SWR](https://console
### Setting Up the Docker Environment for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)
-**Method 1: Obtaining the Docker image from HUAWEI CLOUD SWR**
-
1. Obtain the Docker image.
```
- docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
+ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.6
```
2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
@@ -90,43 +89,13 @@ The Docker image of OpenHarmony is hosted on [HUAWEI CLOUD SWR](https://console
Run the following command in Ubuntu:
```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
- ```
-
- Run the following command in Windows \(assuming that the source code directory is **D:\\OpenHarmony**\):
-
- ```
- docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
- ```
-
-
-**Method 2: Using the Dockerfile to Build a Local Docker Image**
-
-1. Obtain the Dockerfile script for a local Docker image.
-
- ```
- git clone https://gitee.com/openharmony/docs.git
- ```
-
-2. Go to the directory of the Dockerfile code and run the following command to build the Docker image:
-
- ```
- cd docs/docker
- ./build.sh
- ```
-
-3. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
-
- Run the following command in Ubuntu:
-
- ```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
+ docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.6
```
Run the following command in Windows \(assuming that the source code directory is **D:\\OpenHarmony**\):
```
- docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
+ docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.6
```
@@ -164,8 +133,6 @@ hb set
### Setting Up the Docker Environment for Standard-System Devices \(reference memory ≥ 128 MB\)
-**Method 1: Obtaining the Docker image from HUAWEI CLOUD SWR**
-
1. Obtain the Docker image.
```
@@ -179,28 +146,6 @@ hb set
```
-**Method 2: Using the Dockerfile to Build a Local Docker Image**
-
-1. Obtain the Dockerfile script for a local Docker image.
-
- ```
- git clone https://gitee.com/openharmony/docs.git
- ```
-
-2. Go to the directory of the Dockerfile code and run the following command to build the Docker image:
-
- ```
- cd docs/docker/standard
- ./build.sh
- ```
-
-3. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
-
- ```
- docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.7
- ```
-
-
### Building for Standard-System Devices \(reference memory ≥ 128 MB\)
Run the following script to start building for standard-system devices \(reference memory ≥ 128 MB\).
@@ -209,7 +154,7 @@ Run the following script to start building for standard-system devices \(referen
./build.sh --product-name {product_name} --ccache
```
-**product\_name** indicates the platform supported by the current distribution, for example, Hi3516D V300 and RK3568.
+**product\_name** indicates the platform supported by the current distribution, for example, Hi3516DV300 and rk3568.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
diff --git a/en/device-dev/quick-start/quickstart-standard-docker-environment.md b/en/device-dev/quick-start/quickstart-standard-docker-environment.md
index 34d557772b9d5a80846bf587cd38348f57084abd..9374bb781fcdcd4c8a58d3070648e74756f3073c 100644
--- a/en/device-dev/quick-start/quickstart-standard-docker-environment.md
+++ b/en/device-dev/quick-start/quickstart-standard-docker-environment.md
@@ -61,8 +61,6 @@ By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.
## Obtaining the Docker Environment
-**Method 1: Obtaining the Docker image from HUAWEI CLOUD SWR**
-
1. Obtain the Docker image.
```
@@ -76,28 +74,6 @@ By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.
```
-**Method 2: Using the Dockerfile to Build a Local Docker Image**
-
-1. Obtain the Dockerfile script for a local Docker image.
-
- ```
- git clone https://gitee.com/openharmony/docs.git
- ```
-
-2. Go to the directory of the Dockerfile code and run the following command to build the Docker image:
-
- ```
- cd docs/docker/standard
- ./build.sh
- ```
-
-3. Go to the root directory of source code and run the following command to access the Docker build environment:
-
- ```
- docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.7
- ```
-
-
## Building Source Code
1. Run the following script to start building for standard-system devices \(reference memory ≥ 128 MB\).
@@ -106,7 +82,7 @@ By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.
./build.sh --product-name {product_name} --ccache
```
- **product\_name** indicates the platform supported by the current distribution, for example, Hi3516D V300, rk3568.
+ **product\_name** indicates the platform supported by the current distribution, for example, Hi3516DV300, rk3568.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
diff --git a/en/device-dev/subsystems/subsys-data-relational-database-guide.md b/en/device-dev/subsystems/subsys-data-relational-database-guide.md
index 44a0b1829249264fb99aff7cf998dd6a4de43b38..d668fc922079dfa5b38633d6c7a9c65a88351942 100644
--- a/en/device-dev/subsystems/subsys-data-relational-database-guide.md
+++ b/en/device-dev/subsystems/subsys-data-relational-database-guide.md
@@ -68,7 +68,7 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th
Table 5 API for deleting data
| Class| API| Description|
| ---- | ---- | ---- |
- | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | Deletes data. - **deletedRows**: specifies the number of rows to delete.
- **predicates**: specifies the table name and conditions for deleting the data. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies update conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause** and **whereArgs** only.
|
+ | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | Deletes data. - **deletedRows**: specifies the number of rows to delete.
- **predicates**: specifies the table name and conditions for deleting the data. **AbsRdbPredicates** has the following classes:
- **RdbPredicates**: specifies delete conditions by calling its methods, such as **equalTo**.
- **RawRdbPredicates**: specifies the table name, **whereClause** and **whereArgs** only.
|
- Updating data
diff --git a/en/readme/DeviceProfile.md b/en/readme/DeviceProfile.md
new file mode 100644
index 0000000000000000000000000000000000000000..29653fb13b515c0c88d00f1ca819745f1a1a4397
--- /dev/null
+++ b/en/readme/DeviceProfile.md
@@ -0,0 +1,189 @@
+# DeviceProfile
+
+## Introduction
+
+DeviceProfile is used to manage device hardware capabilities and system software features. A typical device profile includes the device type, device name, OS type, and OS version. By allowing quick access to local and remote device profiles, DeviceProfile lays the foundation for initiating distributed services. It provides the following features:
+
+- Querying, inserting, and deleting local device profile information
+- Querying remote device profile information
+- Synchronizing profile information across devices
+- Subscribing to remote device profile changes
+
+Below is the architecture of the DeviceProfile subsystem.
+
+## Architecture
+
+**Figure 1** Architecture of the DeviceProfile subsystem
+
+
+
+## Directory Structure
+
+The main code directory structure of DeviceProfile is as follows:
+
+```
+├── interfaces
+│ └── innerkits
+│ └── distributeddeviceprofile // Internal APIs
+├── ohos.build
+├── sa_profile // SAID profile
+│ ├── 6001.xml
+│ └── BUILD.gn
+├── services
+│ └── distributeddeviceprofile
+│ ├── BUILD.gn
+│ ├── include
+│ │ ├── contentsensor // Header file for content sensor data collection
+│ │ ├── dbstorage // Header file for database operations
+│ │ ├── devicemanager // Header file for device management
+│ │ └── subscribemanager // Header file for subscription management
+│ ├── src
+│ │ ├── contentsensor // Implementation of content sensor data collection
+│ │ ├── dbstorage // Implementation of database operations
+│ │ ├── devicemanager // Implementation of device management
+│ │ ├── subscribemanager // Implementation of subscription management
+│ └── test // Test cases
+└── tools
+ └── dp // Auxiliary test tool
+```
+
+## Constraints
+
+- The devices between which you want to set up a connection must be in the same LAN.
+- Before setting up a connection between two devices, you must bind the devices. For details about the binding process, see relevant descriptions in the Security subsystem readme file.
+
+## Usage
+
+### Querying Profile Information
+
+* Parameters of GetDeviceProfile
+
+| Name| Type| Mandatory| Description|
+| --------- | ---------------------------- | ---- | ----------------------------------- |
+| deviceId | std::string | Yes| ID of the device whose profile is to be queried. A null value indicates the local device.|
+| serviceId | std::string | Yes| Service ID (ID of the service data record).|
+| profile | ServiceCharacteristicProfile | Yes| Return value.|
+
+* Example
+
+```c++
+// Declare the return value.
+ServiceCharacteristicProfile profile;
+// Call GetDeviceProfile.
+DistributedDeviceProfileClient::GetInstance().GetDeviceProfile(deviceId, serviceId, profile);
+std::string jsonData = profile.GetCharacteristicProfileJson();
+result.append("jsonData:" + jsonData + "\n");
+```
+
+### Inserting Profile Information
+
+* Parameters of PutDeviceProfile
+
+| Name| Type| Mandatory| Description|
+| --------- | ---------------------------- | ---- | ----------------------------------- |
+| profile | ServiceCharacteristicProfile | Yes| Profile information to insert.|
+
+* Example
+
+```c++
+// Declare and fill in the data to insert.
+ServiceCharacteristicProfile profile;
+profile.SetServiceId(serviceId);
+profile.SetServiceType(serviceType);
+nlohmann::json j;
+j["testVersion"] = "3.0.0";
+j["testApiLevel"] = API_LEVEL;
+profile.SetCharacteristicProfileJson(j.dump());
+// Call PutDeviceProfile.
+DistributedDeviceProfileClient::GetInstance().PutDeviceProfile(profile);
+```
+
+### Deleting Profile Information
+
+* Parameters of DeleteDeviceProfile
+
+| Name| Type| Mandatory| Description|
+| --------- | ---------------------------- | ---- | ----------------------------------- |
+| serviceId | std::string | Yes| ID of the service record to delete.|
+
+* Example
+
+```c++
+// Declare and fill in the data to delete.
+std::string serviceId = "test";
+// DeleteDeviceProfile
+DistributedDeviceProfileClient::GetInstance().DeleteDeviceProfile(serviceId);
+```
+
+### Synchronizing Profile Information
+
+* Parameters of SyncDeviceProfile
+
+| Name| Type| Mandatory| Description|
+| --------- | ---------------------------- | ---- | ----------------------------------- |
+| syncOption| SyncOption | Yes| Synchronization mode and range.|
+| syncCb | IProfileEventCallback | Yes| Callback used to return the synchronization result.|
+
+* Example
+
+```c++
+// Define the synchronization mode and range.
+SyncOptions syncOption;
+syncOption.SetSyncMode((OHOS::DistributedKv::SyncMode)atoi(mode.c_str()));
+for (const auto& deviceId : deviceIds) {
+ syncOption.AddDevice(deviceId);
+}
+// Call SyncDeviceProfile.
+DistributedDeviceProfileClient::GetInstance().SyncDeviceProfile(syncOption,
+ std::make_shared());
+```
+
+### Subscribing to Profile Events (Synchronization and Change Events)
+
+* Parameters of SubscribeProfileEvents
+
+| Name| Type| Mandatory| Description|
+| -------------- | ---------------------------- | ---- | ----------------------------------- |
+| subscribeInfos | SubscribeInfo | Yes| Type of the event to subscribe to.|
+| eventCb | IProfileEventCallback | Yes| Callback for the subscribed event.|
+| failedEvents | ProfileEvent | Yes| Failure event.|
+
+* Example
+
+```c++
+auto callback = std::make_shared();
+std::list subscribeInfos;
+ExtraInfo extraInfo;
+extraInfo["deviceId"] = deviceId;
+extraInfo["serviceIds"] = serviceIds;
+
+// Subscribe to the EVENT_PROFILE_CHANGED event.
+SubscribeInfo info1;
+info1.profileEvent = ProfileEvent::EVENT_PROFILE_CHANGED;
+info1.extraInfo = std::move(extraInfo);
+subscribeInfos.emplace_back(info1);
+
+// Subscribe to the EVENT_SYNC_COMPLETED event.
+SubscribeInfo info2;
+info2.profileEvent = ProfileEvent::EVENT_SYNC_COMPLETED;
+info2.extraInfo = std::move(extraInfo);
+subscribeInfos.emplace_back(info2);
+
+std::list failedEvents;
+// Call SubscribeProfileEvents.
+DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos,
+ callback, failedEvents);
+sleep(SUBSCRIBE_SLEEP_TIME);
+std::list profileEvents;
+profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED);
+failedEvents.clear();
+// Cancel the subscription.
+DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents,
+ callback, failedEvents);
+```
+
+## Repositories Involved
+
+**DeviceProfile subsystem**
+
+[device\_profile\_core](https://gitee.com/openharmony/device_profile_core)
diff --git a/en/readme/figures/dp-architecture.png b/en/readme/figures/dp-architecture.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d4573646c6b950b3e571d94ee09816397dd1d73
Binary files /dev/null and b/en/readme/figures/dp-architecture.png differ
diff --git a/en/readme/figures/multimedia-architecture.png b/en/readme/figures/multimedia-architecture.png
new file mode 100644
index 0000000000000000000000000000000000000000..7c5341b63aa9ff48f3edfe48ed590a4cec8a3935
Binary files /dev/null and b/en/readme/figures/multimedia-architecture.png differ
diff --git a/en/readme/multimedia.md b/en/readme/multimedia.md
index c26c892898ccec4d4f1a442dc2a9e5abd623f27c..5c42b3425d8e33adb51ff38bb1e0ead7ec0ca8ea 100755
--- a/en/readme/multimedia.md
+++ b/en/readme/multimedia.md
@@ -8,23 +8,24 @@ This subsystem offers various media services covering audio, videos, and cameras
- Audio playback and recording
- Video playback and recording
-
- Photographing and recording \(with cameras\)
-## Architecture
-
-**Figure 1** Common architecture of the multimedia subsystem
-
-
-
+## System Architecture
-**Figure 2** Architecture of the multimedia subsystem suitable for the small system
+**Figure 1** Architecture of the multimedia subsystem
+
-
-
-**Figure 3** Multimedia service flow for the small system
-
+- **Media**: provides playback and recording APIs for applications, and invokes the Gstreamer, Histreamer, or other engines through cross-process calling or direct calling.
+ - For the mini system, the media component invokes Histreamer to support audio playback.
+ - For the small system, the media component invokes recorder_lite to support audio/video recording and invokes player_lite by default to support audio/video playback. If the system variable **debug.media_service.histreamer** is set to **1**, the component invokes Histreamer to support audio/video playback. For details, see [syspara Module](https://device.harmonyos.com/en/docs/documentation/guide/subsys-boot-syspara-0000001063362360) or [syspara_lite](https://gitee.com/openharmony/startup_syspara_lite).
+ - For the standard system, the media component invokes Gstreamer to support audio/video playback and recording.
+- **Audio**: supports audio input and output, policy management, and audio focus management.
+- **Camera**: provides camera operation APIs for preview, photographing, and video recording.
+- **Image**: supports encoding and decoding of common image formats.
+- **MediaLibrary**: supports local and distributed media data access management.
+- **Histreamer**: a lightweight media engine that supports file/network streaming media input, audio/video decoding and playback, audio/video encoding and recording, and plugin extension.
+- **Gstreamer**: an open-source GStreamer engine that supports streaming media, audio and video playback, and recording.
## Directory Structure
@@ -59,6 +60,13 @@ The structure of the repository directory is as follows:
│ ├── figures # Architecture and process figures of the playback and recording module for the standard system
│ ├── frameworks # Playback and recording framework implementation for the standard system
│ └── interfaces # Playback and recording module APIs for the standard system
+├── histreamer # Histreamer engine
+│ └── engine # Media engine
+│ ├── player # Encapsulated player
+│ ├── foundation # Basic tools
+│ ├── pipeline # Pipeline framework
+│ └── plugin # Plugin framework
+│ └── plugins # Platform software plugins
└── utils # Subsystem utility module
└── lite # Utility module for the small system
├── figures # Architecture and process figures of the utility module for the small system
@@ -94,9 +102,10 @@ Load the kernel and related drivers before installing the repository. For detail
[multimedia\_utils\_lite](https://gitee.com/openharmony/multimedia_utils_lite)
+[multimedia\_histreamer](https://gitee.com/openharmony/multimedia_histreamer)
+
[multimedia\_camera\_standard](https://gitee.com/openharmony/multimedia_camera_standard)
[multimedia\_audio\_standard](https://gitee.com/openharmony/multimedia_audio_standard)
[multimedia\_media\_standard](https://gitee.com/openharmony/multimedia_media_standard)
-
diff --git a/en/release-notes/OpenHarmony-2-0-canary.md b/en/release-notes/OpenHarmony-2-0-Canary.md
similarity index 100%
rename from en/release-notes/OpenHarmony-2-0-canary.md
rename to en/release-notes/OpenHarmony-2-0-Canary.md
diff --git a/en/release-notes/OpenHarmony-v3.0.1-LTS.md b/en/release-notes/OpenHarmony-v3.0.1-LTS.md
new file mode 100644
index 0000000000000000000000000000000000000000..93c97e5a99e41cfd30bc037c52959b655999d205
--- /dev/null
+++ b/en/release-notes/OpenHarmony-v3.0.1-LTS.md
@@ -0,0 +1,167 @@
+# OpenHarmony 3.0.1 LTS
+
+## Version Description
+
+OpenHarmony 3.0.1 LTS is a maintenance version with a tag of OpenHarmony 3.0 LTS. This version has rectified certain issues detected in OpenHarmony 3.0 LTS.
+
+
+## Version Mapping
+
+**Table 1** Version mapping of software and tools
+
+| Software/Tool| Version| Remarks|
+| -------- | -------- | -------- |
+| OpenHarmony | 3.0.1 LTS | NA |
+| SDK | 3.0.0.0 (API Version 7 release) | NA |
+| (Optional) HUAWEI DevEco Studio| 3.0 Beta1 | Recommended for developing OpenHarmony applications|
+| (Optional) HUAWEI DevEco Device Tool| 2.2 Beta2 | Recommended for developing OpenHarmony smart devices|
+
+
+## Source Code Acquisition
+
+
+### Acquiring Source Code Using the repo Tool
+
+Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have an SSH public key for access to Gitee.\)
+
+```
+repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.0.1-LTS --no-repo-verify
+repo sync -c
+repo forall -c 'git lfs pull'
+```
+
+Method 2: Use the **repo** tool to download the source code over HTTPS.
+
+```
+repo init -u https://gitee.com/openharmony/manifest.git -b refs/tags/OpenHarmony-v3.0.1-LTS --no-repo-verify
+repo sync -c
+repo forall -c 'git lfs pull'
+```
+
+
+### Acquiring Source Code from Mirrors
+
+**Table 2** Mirrors for acquiring source code
+
+| LTS Code| Version| Mirror| SHA-256 Checksum|
+| -------- | -------- | -------- | -------- |
+| Full code base (for mini, small, and standard systems)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/code-v3.0.1-LTS.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/code-v3.0.1-LTS.tar.gz.sha256) |
+| Standard system solution (binary)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/standard.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/standard.tar.gz.sha256) |
+| Hi3861 solution (binary)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_pegasus.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_pegasus.tar.gz.sha256) |
+| Hi3518 solution (binary)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_aries.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_aries.tar.gz.sha256) |
+| Hi3516 solution-LiteOS (binary)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_taurus.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_taurus.tar.gz.sha256) |
+| Hi3516 solution-Linux (binary)| 3.0.1 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_taurus_linux.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.0.1/hispark_taurus_linux.tar.gz.sha256) |
+
+
+
+## What's New
+
+This version has the following updates to OpenHarmony 3.0 LTS.
+
+
+### Feature Updates
+
+This version does not involve feature updates.
+
+
+### API Updates
+
+This version does not involve API updates.
+
+
+### Chip and Development Board Adaptation
+
+For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md).
+
+
+## Resolved Issues
+
+**Table 3** Issues resolved for the mini and small systems
+
+| Issue No.| Description|
+| -------- | -------- |
+| [I4BJFU](https://gitee.com/openharmony/kernel_liteos_a/issues/I4BJFU) | An error occurs when the dyload_posix module removes a file.|
+| [I42N33](https://gitee.com/openharmony/third_party_mksh/issues/I42N33) | During the integration test, the Ctrl+C operation does not function after the **cat** command is run. A device restart is required.|
+| [I4C8BO](https://gitee.com/openharmony/docs/issues/I4C8BO?from=project-issue) | The basic functions of the media subsystem (on a mini- or small-system device) are abnormal when Hi3516D V300 or Hi3518E V300 is burnt and configured by following the instructions in the official website.|
+| [I4BWKC](https://gitee.com/openharmony/drivers_framework/issues/I4BWKC) | The camera driver on the Hi3516D V300 board does not function properly in the pressure test.|
+| [I4BW0G](https://gitee.com/openharmony/drivers_framework/issues/I4BW0G) | The **ResetDriver** interface of the Hi3516D V300 board fails to be called.|
+| [I4C7ZK](https://gitee.com/openharmony/multimedia_camera_lite/issues/I4C7ZK) | For Hi3516D V300, the resident memory of the small system exceeds the baseline.|
+| [I434P1](https://gitee.com/openharmony/multimedia_camera_lite/issues/I434P1) | For Hi3518E V300, the resident memory exceeds the baseline.|
+| [I48IM7](https://gitee.com/openharmony/hiviewdfx_hilog/issues/I48IM7) | During the HiLog pressure test, the hilogd restarts unexpectedly, and the hilog commands cannot be used.|
+| [I4EGMD](https://gitee.com/openharmony/aafwk_aafwk_lite/issues/I4EGMD) | The serialization and deserialization methods of **Want** are defective.|
+| [I4CED3](https://gitee.com/openharmony/account_os_account/issues/I4CED3) | The JS API returns both "err" and "data" in one message.|
+| [I4BXZ1](https://gitee.com/openharmony/app_samples/issues/I4BXZ1) | The **\** component does not respond to clicks.|
+| [I4CMMH](https://gitee.com/openharmony/ace_ace_engine/issues/I4CMMH) | The display effect of the **\** component is abnormal.|
+| [I4CE7D](https://gitee.com/openharmony/miscservices_inputmethod/issues/I4CE7D) | The response time of the edit box is inappropriate.|
+| [I4HI4C](https://gitee.com/openharmony/ai_engine/issues/I4HI4C) | There is a failed item of the TDD test on a small-system device. This failure is caused by the inappropriate test case comparison time range.|
+| [I4EUOW](https://gitee.com/openharmony/ai_engine/issues/I4EUOW) | The number of case execution threads is inappropriate.|
+| [I4HTFS](https://gitee.com/openharmony/appexecfwk_appexecfwk_lite/issues/I4HTFS) | BMS adaptation for the mini system is not supported.|
+| [I4C3BE](https://gitee.com/openharmony/communication_dsoftbus/issues/I4C3BE) | During passive Bluetooth Low Energy (BLE) discovery, the Bluetooth advertisement is frequently updated and, when the Bluetooth resources are used up, automatically disabled.|
+| [I4I7QL](https://gitee.com/openharmony/developtools_packing_tool/issues/I4I7QL) | Packing fails when an ability has two widgets.|
+| [I4BW0G](https://gitee.com/openharmony/drivers_framework/issues/I4BW0G) | There is a possibility that the Wi-Fi **ResetDriver** interface fails to be called.|
+| [I4GBB6](https://gitee.com/openharmony/device_qemu/issues/I4GBB6) | The RISC-V QEMU emulator fails to run.|
+| [I4CE7E](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CE7E) | **drivers/mtd/multi_partition/** in the LiteOS-A kernel is implemented by using the driver functions in **device/hisilicon**.|
+| [I4JBEH](https://gitee.com/openharmony/drivers_framework/issues/I4JBEH) | Memory leakage occurs when the DMA transmission interface of HDF is repeatedly used.|
+| [I4IGQ0](https://gitee.com/openharmony/drivers_framework/issues/I4IGQ0) | Resources are released after component detection fails.|
+| [I4JPCG](https://gitee.com/openharmony/drivers_framework/issues/I4JPCG) | The PWM backlight cannot be set to 0.|
+| [I4ERM4](https://gitee.com/openharmony/drivers_peripheral/issues/I4ERM4) | A test case fails to be displayed.|
+| [I4CMUY](https://gitee.com/openharmony/drivers_adapter_khdf_linux/issues/I4CMUY) | The hdf\_peripheral\_wlan\_test\_performance.bin test suite fails to run.|
+| [I4FIP2](https://gitee.com/openharmony/kernel_liteos_a/issues/I4FIP2) | The **ioctl** function of the LiteOS_A kernel does not support the **SIOCGIFBRDADDR** option.|
+| [I4GVF7](https://gitee.com/openharmony/kernel_liteos_a/issues/I4GVF7) | The permissions on the files and folders generated by the blackbox are inappropriate.|
+| [I4EV8U](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EV8U) | Three test cases, including IO_TEST_PPOLL_001, fail in the liteos\_a\_io\_unittest.bin\#IoTest module.|
+| [I4EV3X](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EV3X) | Seven test cases, including ItTestSys018, fail in the liteos\_a\_sys\_unittest.bin\#SysTest module.|
+| [I4EVG0](https://gitee.com/openharmony/kernel_liteos_a/issues/I4EVG0) | The test case ItTestMisc009 fails in the liteos\_a\_misc\_unittest.bin\#MiscTest module.|
+| [I4JYAX](https://gitee.com/openharmony/kernel_liteos_a/issues/I4JYAX) | The jffs2 adaptation layer incorrectly releases the lock.|
+| [I4FIQW](https://gitee.com/openharmony/kernel_liteos_m/issues/I4FIQW) | The **ioctl** function of the LiteOS_M kernel does not support the **SIOCGIFBRDADDR** option.|
+| [I4ELVA](https://gitee.com/openharmony/kernel_liteos_m/issues/I4ELVA) | The **read** interface at the VFS layer of the file system incorrectly determines whether **g_fs** is null.|
+| [I4C6P2](https://gitee.com/openharmony/kernel_liteos_m/issues/I4C6P2) | The **LOS_QueueInfoGet** function incorrectly counts the tasks waiting to be read and written.|
+| [I4C5RW](https://gitee.com/openharmony/kernel_liteos_m/issues/I4C5RW) | The error indicating that the **OS_TASK_STACK_PROTECT_SIZE** macro is not defined occurs when the MPU is enabled to protect the task stack.|
+| [I4G4VK](https://gitee.com/openharmony/kernel_liteos_m/issues/I4G4VK) | Some macros are inappropriate. If they (for example, **inet_addr**) are changed to functions, the lwIP header file is not required for external calling.|
+| [I4FVGV](https://gitee.com/openharmony/kernel_liteos_m/issues/I4FVGV) | The default lwIP configuration of the LiteOS_M kernel is inappropriate.|
+| [I4CE7D](https://gitee.com/openharmony/miscservices_inputmethod/issues/I4CE7D) | There is no necessary to start the input method after a 3-second delay.|
+| [I4CFOO](https://gitee.com/openharmony/multimedia_media_lite/issues/I4CFOO) | After an application running on the Linux system records videos for multiple times, the size of the last recording file is 0 when the system is restarted without exiting the application.|
+| [I4CLGW](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CLGW) | The page cache is inappropriate.|
+| [I4HKQ2](https://gitee.com/openharmony/vendor_hisilicon/issues/I4HKQ2) | The mechanism for the LiteOS running on a mini-system board to obtain the UDID is inappropriate.|
+| [I4FVJN](https://gitee.com/openharmony/startup_syspara_lite/issues/I4FVJN) | Mini system compilation fails because the dependency to mbedTLS is not added.|
+| [I4CE7E](https://gitee.com/openharmony/kernel_liteos_a/issues/I4CE7E) | **drivers/mtd/multi_partition/** in the LiteOS-A kernel is implemented by using the driver functions in **device/hisilicon**.|
+
+**Table 4** Issues resolved for the standard system
+
+| Issue No.| Description|
+| -------- | -------- |
+| [I4BX4J](https://gitee.com/openharmony/hiviewdfx_hicollie/issues/I4BX4J?from=project-issue) | The Hi3516D V300 board fails to call the **hicollie** interface.|
+| [I4BX1X](https://gitee.com/openharmony/hiviewdfx_hitrace/issues/I4BX1X?from=project-issue) | The Hi3516D V300 board fails to call the **hitrace** interface.|
+| [I4BVUL](https://gitee.com/openharmony/communication_wifi/issues/I4BVUL?from=project-issue) | When access points (APs) are changed, the success rate for networking between standard-system devices and mobile phones is 91%, lower than the expected value (98%).|
+| [I4BW6E](https://gitee.com/openharmony/security_deviceauth/issues/I4BW6E) | During the test for networking between standard-system devices and mobile phones, when the mobile phone disables and enables the network access repeatedly for around 30 times, the networking fails.|
+| [I4BVVW](https://gitee.com/openharmony/communication_dsoftbus/issues/I4BVVW) | During the test for networking between standard-system devices and mobile phones, when the Wi-Fi switch is turned on and off repeatedly, the networking success rate is 97%, lower than the expected value.|
+| [I48YPH](https://gitee.com/openharmony/security_deviceauth/issues/I48YPH?from=project-issue) | During the test for discovery and networking performance, 3 out of 110 networking attempts fails.|
+| [I4492M](https://gitee.com/openharmony/communication_dsoftbus/issues/I4492M) | The offline device detection takes about 30s longer than the specifications.|
+| [I44W7U](https://gitee.com/openharmony/graphic_standard/issues/I44W7U?from=project-issue) | The child window does not support zooming. As a result, the progress bar is hidden during video playback.|
+| [I480Z1](https://gitee.com/openharmony/communication_dsoftbus/issues/I480Z1?from=project-issue) | Softbus_server crashes when executing **socketfuzz**.|
+| [I4BGLS](https://gitee.com/openharmony/security_deviceauth/issues/I4BGLS?from=project-issue) | The key imported by using `import_signed_auth_info_hilink` is used for identifying the HiChain connection. After the key is imported, it is encrypted and stored in the file and is not cleared from the heap after being returned.|
+| [I4A10Q](https://gitee.com/openharmony/startup_appspawn/issues/I4A10Q?from=project-issue) | The performance of Hi3516 3.0.0.6 static KPIs deteriorates severely.|
+| [I4BXYT](https://gitee.com/openharmony/developtools_hdc_standard/issues/I4BXYT) | After device restart, developers must run the **hdc_std kill** command to discover the device again.|
+| [I4KUTY](https://gitee.com/openharmony/ace_engine_lite/issues/I4KUTY) | There are invalid return values.|
+| [I4DMFV](https://gitee.com/openharmony/ark_js_runtime/issues/I4DMFV) | The conversion from UTF-16 to UTF-8 is inappropriate.|
+| [I4HGVM](https://gitee.com/openharmony/communication_dsoftbus/issues/I4HGVM) | The dependency on mbedTLS is missing for the standard system.|
+| [I4DLV2](https://gitee.com/openharmony/drivers_framework/issues/I4DLV2) | An invalid memory access error occurs due to the HidInfo\* type.|
+| [I4CIJJ](https://gitee.com/openharmony/third_party_flutter/issues/I4CIJJ) | ACE does not support GPU rendering.|
+| [I4G31Z](https://gitee.com/openharmony/third_party_freetype/issues/I4G31Z) | An update for the font engine version from 2.10.1 to 2.10.4 is unavailable.|
+| [I4H06M](https://gitee.com/openharmony/third_party_harfbuzz/issues/I4H06M) | An update for the OpenType text shaping engine from 2.6.1 to 2.8.1 is unavailable.|
+| [I4FS7V](https://gitee.com/openharmony/third_party_lwip/issues/I4FS7V) | The **LWIP\_NETCONN\_FULLDUPLEX** macro is not used to control the initialization of **conn->mbox\_threads\_waiting**.|
+| [I43KL7](https://gitee.com/openharmony/graphic_standard/issues/I43KL7) | The synthesizer does not support GPU synthesis.|
+
+
+## Known Issues
+
+**Table 5** Known issues
+
+| Issue No.| Description| Impact| To Be Resolved On|
+| -------- | -------- | -------- | -------- |
+| [I4NMXQ](https://gitee.com/openharmony/xts_acts/issues/I4NMXQ?from=project-issue) | The XTS test suites storagefileioperformancejstest and storagefilestabilityjstest cannot be automatically executed on a standard-system device.| This issue is caused by the XTS test suite framework. The test suites can only be manually executed. This issue does not affect functions.| 2022/01/30 |
+| [I4NU92](https://gitee.com/openharmony/communication_wifi/issues/I4NU92) | Mini-system Hi3516_Linux: The ActsLwipTest.bin test suite has a failed test item.| The automatic test case fails to invoke the kernel to read time_out. This issue does not affect the communication function.| 2022/01/15 |
+| [I4NTKG](https://gitee.com/openharmony/xts_acts/issues/I4NTKG) | Two failed items are displayed when the XTS test suite WeekPluralNumberTest is executed.| This is a test case issue and does not affect functions.| 2022/01/15 |
+| [I4OWWM](https://gitee.com/openharmony/xts_acts/issues/I4OWWM) | The JSON file corresponding to the WeekPluralNumbertest module is incorrectly configured. During case execution, the error message "required device does not exist" is displayed.| The JSON file configuration is incorrect. This issue does not affect functions.| 2022/01/15 |
+| [I4MSVV](https://gitee.com/openharmony/xts_acts/issues/I4MSVV?from=project-issue) | During the XTS test on the standard system, there are three failed items of the HiCollieCppTest cases in the ActsHiCollieCppTest module.| The test suite name is changed. As a result, the test case with the text verification function fails. This issue does not affect functions.| 2022/01/15 |
+| [I4MSWM](https://gitee.com/openharmony/xts_acts/issues/I4MSWM?from=project-issue) | During the XTS test on the standard system, there is one failed item for faultloggertest in the ActsFaultLoggerTest module.| The test suite name is changed. As a result, the test case with the text verification function fails. This issue does not affect functions.| 2022/01/15 |
+| [I4NODO](https://gitee.com/openharmony/device_manager/issues/I4NODO) | During the test for the Hi3516 board running on a standard-system device, the E2E test of the distributed service hopping fails.| The DM component fails to repeatedly create a group. This issue affects the services that use hopping in the same way as that described in the issue details. Other services are not affected.| 2022/01/30 |
diff --git a/en/release-notes/Readme.md b/en/release-notes/Readme.md
index bc2cf67f424665d1346bfd1e4955ed8f56bbb2ee..1182087f12c19aff9aa3772fe559feed1ba534ef 100644
--- a/en/release-notes/Readme.md
+++ b/en/release-notes/Readme.md
@@ -1,11 +1,12 @@
# OpenHarmony Release Notes
## OpenHarmony 3.x Releases
- [OpenHarmony v3.1 Beta (2021-12-31)](OpenHarmony-v3.1-beta.md)
+- [OpenHarmony v3.0.1 LTS (2022-01-12)](OpenHarmony-v3.0.1-LTS.md)
- [OpenHarmony v3.0 LTS (2021-09-30)](OpenHarmony-v3.0-LTS.md)
## OpenHarmony 2.x Releases
- [OpenHarmony v2.2 beta2 (2021-08-04)](OpenHarmony-v2.2-beta2.md)
-- [OpenHarmony 2.0 Canary (2021-06-02)](OpenHarmony-2-0-canary.md)
+- [OpenHarmony 2.0 Canary (2021-06-02)](OpenHarmony-2-0-Canary.md)
## OpenHarmony 1.x Releases
- [OpenHarmony v1.1.3 LTS (2021-09-30)](OpenHarmony-v1-1-3-LTS.md)
- [OpenHarmony v1.1.2 LTS (2021-08-04)](OpenHarmony-v1.1.2-LTS.md)
diff --git a/zh-cn/application-dev/background-task-management/background-task-dev-guide.md b/zh-cn/application-dev/background-task-management/background-task-dev-guide.md
index 590eeaeb10e8fb8eef38659490aeaeb0f8badc0b..c23b3f917dfa750846432232963eac050d88f963 100644
--- a/zh-cn/application-dev/background-task-management/background-task-dev-guide.md
+++ b/zh-cn/application-dev/background-task-management/background-task-dev-guide.md
@@ -34,7 +34,7 @@ import backgroundTaskManager from '@ohos.backgroundTaskManager';
import backgroundTaskManager from '@ohos.backgroundTaskManager';
let myReason = 'test requestSuspendDelay';
let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => {
- console.info("Request suspend delay will time out.");
+ console.info("Request suspension delay will time out.");
});
var id = delayInfo.requestId;console.info("requestId is: " + id);
```
@@ -61,7 +61,7 @@ import backgroundTaskManager from '@ohos.backgroundTaskManager';
let myReason = 'test requestSuspendDelay';
// 申请延迟挂起
let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => {
- console.info("Request suspend delay will time out.");
+ console.info("Request suspension delay will time out.");
});
// 打印延迟挂起信息
var id = delayInfo.requestId;
diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_20220117.jpg b/zh-cn/application-dev/media/figures/zh-ch_image_20220117.jpg
index bc56b9d8395873193bbad2b3faf7340c6728af60..8fba3a7beeb4efc7599dde3f32b228135ed92fce 100644
Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_20220117.jpg and b/zh-cn/application-dev/media/figures/zh-ch_image_20220117.jpg differ
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index 5834381fe4f5cddb0c648316714160f6513aad55..c26de29843cc9bbcddf0ab54e931b488a87eb260 100644
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -20,6 +20,7 @@
- [媒体服务](js-apis-media.md)
- 安全
- [用户认证](js-apis-useriam-userauth.md)
+ - [访问控制](js-apis-security-accessToken.md)
- 数据管理
- [轻量级存储](js-apis-data-storage.md)
- [分布式数据管理](js-apis-distributed-data.md)
@@ -31,6 +32,7 @@
- [文件管理](js-apis-fileio.md)
- [Statfs](js-apis-statfs.md)
- [目录环境](js-apis-environment.md)
+ - [公共文件访问与管理](js-apis-filemanager.md)
- 账号管理
- [分布式帐号管理](js-apis-distributed-account.md)
- [应用帐号管理](js-apis-appAccount.md)
@@ -75,4 +77,18 @@
- [xml解析与生成](js-apis-xml.md)
- [xml转换JavaScript](js-apis-convertxml.md)
- [启动一个worker](js-apis-worker.md)
+ - [线性容器ArrayList](js-apis-arraylist.md)
+ - [线性容器Deque](js-apis-deque.md)
+ - [线性容器List](js-apis-list.md)
+ - [线性容器LinkedList](js-apis-linkedlist.md)
+ - [线性容器Queue](js-apis-queue.md)
+ - [线性容器Stack](js-apis-stack.md)
+ - [线性容器Vector](js-apis-vector.md)
+ - [非线性容器HashSet](js-apis-hashset.md)
+ - [非线性容器HashMap](js-apis-hashmap.md)
+ - [非线性容器PlainArray](js-apis-plainarray.md)
+ - [非线性容器TreeMap](js-apis-treemap.md)
+ - [非线性容器TreeSet](js-apis-treeset.md)
+ - [非线性容器LightWeightMap](js-apis-lightweightmap.md)
+ - [非线性容器LightWeightSet](js-apis-lightweightset.md)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-arraylist.md b/zh-cn/application-dev/reference/apis/js-apis-arraylist.md
new file mode 100644
index 0000000000000000000000000000000000000000..cecb7b7b0cb306fec81610b475839fe756024ec7
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-arraylist.md
@@ -0,0 +1,518 @@
+# 线性容器ArrayList
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```
+import {ArrayList} from '@ohos.util.ArrayList'
+```
+
+## 权限
+
+无
+
+## ArrayList
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | ArrayList的元素个数 |
+
+
+### constructor
+
+constructor();
+
+ArrayList的构造函数。
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ ```
+
+
+### add
+
+add(element: T): boolean;
+
+在ArrayList尾部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 插入成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add("a");
+ arrayList.add(1);
+ let b = [1, 2, 3];
+ arrayList.add(b);
+ let c = {name: "lala", age: "13"};
+ arrayList.add(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void;
+
+在长度范围内任意位置插入指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 被插入的元素 |
+ | index | number | 是 | 被插入的位置索引 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.insert("A", 0);
+ arrayList.insert(0, 1);
+ arrayList.insert(true, 2);
+ ```
+
+### has
+
+has(element: T): boolean;
+
+判断此ArrayList中是否含有该指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ arrayList.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+### getIndexOf
+
+getIndexOf(element: T): number;
+
+返回指定元素第一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(2);
+ arrayList.add(1);
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.getIndexOf(2);
+ ```
+### getLastIndexOf
+
+getLastIndexOf(element: T): number;
+
+返回指定元素最后一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素最后一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(2);
+ arrayList.add(1);
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.getLastIndexOf(2);
+ ```
+### removeByIndex
+
+removeByIndex(index: number): T;
+
+根据元素的下标值查找元素,返回元素后将其删除。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定元素的下标值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.removeByIndex(2);
+ ```
+
+### remove
+
+remove(element: T): boolean;
+
+删除查找到的第一个指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.remove(2);
+ ```
+
+### removeByRange
+
+removeByRange(fromIndex: number, toIndex: number): void;
+
+从一段范围内删除元素,包括起始值但不包括终止值。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | fromIndex | number | 是 | 起始下标 |
+ | toIndex | number | 是 | 终止下标 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.removeByRange(2, 4);
+ arrayList.removeByRange(4, 3);
+ arrayList.removeByRange(2, 6);
+ ```
+### replaceAllElements
+replaceAllElements(callbackfn: (value: T, index?: number, arraylist?: ArrayList<T>) => T,
+thisArg?: Object): void;
+
+用户操作ArrayList中的元素,用操作后的元素替换原元素并返回操作后的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | arraylist | ArrayList<T> | 否 | 当前调用replaceAllElements方法的实例对象 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.replaceAllElements((value, index) => {
+ return value = 2 * value;
+ });
+ arrayList.replaceAllElements((value, index) => {
+ return value = value - 2;
+ });
+ ```
+### forEach
+forEach(callbackfn: (value: T, index?: number, arraylist?: ArrayList<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历ArrayList实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数。 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素。 |
+ | index | number | 否 | 当前遍历到的下标值。 |
+ | arraylist | ArrayList<T> | 否 | 当前调用forEach方法的实例对象。 |
+
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.forEach((value, index) => {
+ console.log(value, index);
+ });
+ ```
+### sort
+sort(comparator?: (firstValue: T, secondValue: T) => number): void;
+
+对ArrayList中的元素进行一个排序操作
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | comparator | function | 否 | 回调函数 |
+
+- comparator的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | firstValue | T | 是 | 前一项元素 |
+ | secondValue | T | 是 | 后一项元素 |
+
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.sort(a, (b => a - b));
+ arrayList.sort(a, (b => b - a));
+ arrayList.sort();
+ ```
+### subArrayList
+subArrayList(fromIndex: number, toIndex: number): ArrayList<T>;
+
+根据下标截取ArrayList中的一段元素,并返回这一段ArrayList实例, 包括起始值但不包括终止值
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | fromIndex | number | 是 | 起始下标 |
+ | toIndex | number | 是 | 终止下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | ArrayList<T> | 返回ArrayList对象实例 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.subArrayList(2, 4);
+ arrayList.subArrayList(4, 3);
+ arrayList.subArrayList(2, 6);
+ ```
+
+### clear
+clear(): void;
+
+清除ArrayList中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.clear();
+ ```
+### clone
+clone(): ArrayList<T> ;
+
+克隆一个与ArrayList一模一样的实例,并返回克隆后的实例,修改克隆后的实例并不会影响原实例。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | ArrayList<T> | 返回ArrayList对象实例 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.clone();
+ ```
+### getCapacity
+getCapacity(): number;
+
+获取当前实例的容量大小。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回arraylist的容量大小 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.getCapacity();
+ ```
+### convertToArray
+convertToArray(): Array<T>;
+
+把当前ArrayList实例转换成数组,并返回转换后的数组。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Array<T> | 返回数组类型 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.convertToArray();
+ ```
+### isEmpty
+isEmpty(): boolean;
+
+判断该ArrayList是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.isEmpty();
+ ```
+### increaseCapacityTo
+increaseCapacityTo(newCapacity: number): void;
+
+如果传入的新容量大于或等于ArrayList中的元素个数,将容量变更为新容量。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | newCapacity | number | 是 | 新容量 |
+
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.increaseCapacityTo(2);
+ arrayList.increaseCapacityTo(8);
+ ```
+### trimToCurrentLength
+trimToCurrentLength(): void;
+
+把容量限制为当前的length大小。
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+ arrayList.trimToCurrentLength(2);
+ ```
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let arrayList = new ArrayList();
+ arrayList.add(2);
+ arrayList.add(4);
+ arrayList.add(5);
+ arrayList.add(4);
+
+ // 使用方法一:
+ for (let item of arrayList) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = arrayList[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md
index 636afc455eb984765269155842edec14c2cfbda5..4369e06d5710ff9b4fcefec08576015c83ebba7b 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-audio.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md
@@ -7,11 +7,6 @@ import audio from '@ohos.multimedia.audio';
```
-## 权限
-
-无
-
-
## getAudioManager
getAudioManager(): AudioManager
@@ -115,6 +110,7 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err)=>{
if (err) {
console.error('Failed to set the volume. ${err.message}');
@@ -146,6 +142,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(()=>
console.log('Promise returned to indicate a successful volume setting.');
)
@@ -167,6 +164,7 @@ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): v
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error('Failed to obtain the volume. ${err.message}');
@@ -197,6 +195,7 @@ getVolume(volumeType: AudioVolumeType): Promise<number>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the volume is obtained.' + value);
)
@@ -218,6 +217,7 @@ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>)
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error('Failed to obtain the minimum volume. ${err.message}');
@@ -248,6 +248,7 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promised returned to indicate that the minimum volume is obtained.' + value);
)
@@ -269,6 +270,7 @@ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>)
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error('Failed to obtain the maximum volume. ${err.message}');
@@ -299,6 +301,7 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=>
console.log('Promised returned to indicate that the maximum volume is obtained.');
)
@@ -321,6 +324,7 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
if (err) {
console.error('Failed to mute the stream. ${err.message}');
@@ -353,6 +357,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>
```
+var audioManager = audio.getAudioManager();
audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
console.log('Promise returned to indicate that the stream is muted.');
)
@@ -375,6 +380,7 @@ isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): voi
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error('Failed to obtain the mute status. ${err.message}');
@@ -406,6 +412,7 @@ isMute(volumeType: AudioVolumeType): Promise<boolean>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value);
)
@@ -427,6 +434,7 @@ isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): v
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error('Failed to obtain the active status of the stream. ${err.message}');
@@ -457,6 +465,7 @@ isActive(volumeType: AudioVolumeType): Promise<boolean>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
console.log('Promise returned to indicate that the active status of the stream is obtained.' + value);
)
@@ -478,6 +487,7 @@ setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
if (err) {
console.error('Failed to set the ringer mode. ${err.message}');
@@ -508,6 +518,7 @@ setRingerMode(mode: AudioRingMode): Promise<void>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
console.log('Promise returned to indicate a successful setting of the ringer mode.');
)
@@ -529,6 +540,7 @@ getRingerMode(callback: AsyncCallback<AudioRingMode>): void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getRingerMode((err, value) => {
if (err) {
console.error('Failed to obtain the ringer mode. ${err.message}');
@@ -554,6 +566,7 @@ getRingerMode(): Promise<AudioRingMode>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getRingerMode().then((value) =>
console.log('Promise returned to indicate that the ringer mode is obtained.' + value);
)
@@ -576,6 +589,7 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => {
if (err) {
console.error('Failed to set the audio parameter. ${err.message}');
@@ -607,6 +621,7 @@ setAudioParameter(key: string, value: string): Promise<void>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
console.log('Promise returned to indicate a successful setting of the audio parameter.');
)
@@ -628,6 +643,7 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getAudioParameter('PBits per sample', (err, value) => {
if (err) {
console.error('Failed to obtain the value of the audio parameter. ${err.message}');
@@ -658,6 +674,7 @@ getAudioParameter(key: string): Promise<string>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getAudioParameter('PBits per sample').then((value) =>
console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value);
)
@@ -678,6 +695,7 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{
if (err) {
console.error('Failed to obtain the device list. ${err.message}');
@@ -708,6 +726,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value)=>{
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
console.log('Promise returned to indicate that the device list is obtained.');
)
@@ -730,6 +749,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean, callback: AsyncCallback
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
if (err) {
console.error('Failed to set the active status of the device. ${err.message}');
@@ -762,6 +782,7 @@ setDeviceActive(deviceType: DeviceType, active: boolean): Promise<void>
```
+var audioManager = audio.getAudioManager();
audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
console.log('Promise returned to indicate that the device is set to the active status.');
)
@@ -783,6 +804,7 @@ isDeviceActive(deviceType: DeviceType, callback: AsyncCallback<boolean>):
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
if (err) {
console.error('Failed to obtain the active status of the device. ${err.message}');
@@ -814,6 +836,7 @@ isDeviceActive(deviceType: DeviceType): Promise<boolean>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) =>
console.log('Promise returned to indicate that the active status of the device is obtained.' + value);
)
@@ -835,6 +858,7 @@ setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setMicrophoneMute(true, (err) => {
if (err) {
console.error('Failed to mute the microphone. ${err.message}');
@@ -865,6 +889,7 @@ setMicrophoneMute(mute: boolean): Promise<void>
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.setMicrophoneMute(true).then(() =>
console.log('Promise returned to indicate that the microphone is muted.');
)
@@ -885,6 +910,7 @@ isMicrophoneMute(callback: AsyncCallback<boolean>): void
**示例:**
```
+var audioManager = audio.getAudioManager();
audioManager.isMicrophoneMute((err, value) => {
if (err) {
console.error('Failed to obtain the mute status of the microphone. ${err.message}');
@@ -910,6 +936,7 @@ isMicrophoneMute(): Promise<boolean>
```
+var audioManager = audio.getAudioManager();
audioManager.isMicrophoneMute().then((value) =>
console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value);
)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md
index 6054f6d62100b455a5abc2092bae1ac30dd957a5..774b6c05d8efe64a01395bdf5e7018778e1e3750 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md
@@ -39,7 +39,7 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
```
let myReason = 'test requestSuspendDelay';
let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => {
- console.info("Request suspend delay will time out.");
+ console.info("Request suspension delay will time out.");
})
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md
index 57a8070f4f4d702331a2c2fbb1868f0f44e30fdd..c9a4b11914a4240013c0475d85a6aaa5acab39b3 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md
@@ -10,6 +10,9 @@
import batteryInfo from '@ohos.batteryInfo';
```
+## 系统能力
+
+SystemCapability.PowerManager.BatteryManager
## 属性
diff --git a/zh-cn/application-dev/reference/apis/js-apis-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-brightness.md
index 1825ff78c9b0b02223f4aecd41ddafe9575fde44..9692cb136f5ac05ef9fe2152f8ce73297994a074 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-brightness.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-brightness.md
@@ -10,6 +10,9 @@
import brightness from '@ohos.brightness';
```
+## 系统能力
+
+SystemCapability.PowerManager.DisplayPowerManager
## brightness.setValue
diff --git a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md
index 6b5edb199d7c4f174d49dadf620a640afff7bf60..1520b77763fb5d845d153beb3b12acd0a9d2c276 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md
@@ -7,14 +7,9 @@
## 导入模块
```
-import convertxml from '@ohos.convertxml'
+import convertxml from '@ohos.convertxml';
```
-
-## 权限
-
-无
-
## ConvertXML
@@ -48,7 +43,7 @@ convert(xml: string, options?: ConvertOptions) : Object
' Work' +
' Play' +
'';
- var conv= new convertxml.ConvertXML();
+ var conv = new convertxml.ConvertXML();
var result1 = conv.convert(xml, {trim: false, ignoreDeclaration: false});
console.log(result1)
```
@@ -63,7 +58,7 @@ convert(xml: string, options?: ConvertOptions) : Object
| ignoreInstruction | boolean | 否 | 是否忽略xml的写入处理指令,默认false。 |
| ignoreAttributes | boolean | 否 | 是否跨多行打印属性并缩进属性,默认false。 |
| ignoreComment | boolean | 否 | 是否忽略元素的注释信息,默认false。 |
-| ignoreCdata | boolean | 否 | 是否忽略元素的CData信息,默认false。 |
+| ignoreCDATA | boolean | 否 | 是否忽略元素的CDATA信息,默认false。 |
| ignoreDoctype | boolean | 否 | 是否忽略元素的Doctype信息,默认false。 |
| ignoreText | boolean | 否 | 是否忽略元素的文本信息,默认false。 |
| declarationKey | string | 否 | 用于输出对象中declaration的属性键的名称,默认_declaration。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-deque.md b/zh-cn/application-dev/reference/apis/js-apis-deque.md
new file mode 100644
index 0000000000000000000000000000000000000000..8a845a02e8a12d2f5b103c11c9ef21982ef84a65
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-deque.md
@@ -0,0 +1,251 @@
+# 线性容器Deque
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {Deque} from '@ohos.util.Deque'
+```
+
+## 权限
+
+无
+
+## Deque
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | Deque的元素个数 |
+
+### constructor
+
+constructor();
+
+Deque的构造函数。
+
+- 示例:
+ ```
+ let queue = new Queue();
+ ```
+
+### insertFront
+
+insertFront(element: T): void;
+
+在deque头部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 示例:
+ ```
+ let deque = new Deque;
+ deque.insertFront("a");
+ deque.insertFront(1);
+ let b = [1, 2, 3];
+ deque.insertFront(b);
+ let c = {name : "lala", age : "13"};
+ deque.insertFront(false);
+ ```
+### insertEnd
+
+insertEnd(element: T): void;
+
+在deque尾部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 示例:
+ ```
+ let deque = new Deque;
+ deque.insertEnd("a");
+ deque.insertEnd(1);
+ let b = [1, 2, 3];
+ deque.insertEnd(b);
+ let c = {name : "lala", age : "13"};
+ deque.insertEnd(false);
+ ```
+### has
+
+has(element: T): boolean;
+
+判断此Deque中是否含有该指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.has("Ahfbrgrbgnutfodgorrogorg");
+ deque.insertFront("Ahfbrgrbgnutfodgorrogorg");
+ deque.has("Ahfbrgrbgnutfodgorrogorg");
+ ```
+### popFirst
+
+popFirst(): T;
+
+删除并返回双端队列的首元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertFront(2);
+ deque.insertFront(4);
+ deque.insertEnd(5);
+ deque.insertFront(2);
+ deque.insertFront(4);
+ deque.popFirst();
+ ```
+### popLast
+
+popLast(): T;
+
+删除并返回双端队列的尾元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertFront(2);
+ deque.insertEnd(4);
+ deque.insertFront(5);
+ deque.insertFront(2);
+ deque.insertFront(4);
+ deque.popLast();
+ ```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, deque?: Deque<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历Deque实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | deque | Deque<T> | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertFront(2);
+ deque.insertEnd(4);
+ deque.insertFront(5);
+ deque.insertEnd(4);
+ deque.forEach((value, index) => {
+ console.log(value, index);
+ });
+ ```
+
+### getFirst
+
+getFirst(): T;
+获取Deque实例中的头元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertEnd(2);
+ deque.insertEnd(4);
+ deque.insertFront(5);
+ deque.insertFront(4);
+ deque.getFirst();
+ ```
+### getLast
+
+getLast(): T;
+获取Deque实例中的尾元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertFront(2);
+ deque.insertFront(4);
+ deque.insertFront(5);
+ deque.insertFront(4);
+ deque.getLast();
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器。 |
+
+
+- 示例:
+ ```
+ let deque = new Deque();
+ deque.insertFront(2);
+ deque.insertFront(4);
+ deque.insertFront(5);
+ deque.insertFront(4);
+
+ // 使用方法一:
+ for (let item of deque) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = deque[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-environment.md b/zh-cn/application-dev/reference/apis/js-apis-environment.md
index 2d38edd1d107c7713d9ef9e6815710e403650ecc..c4077db9a74a56395243a1a98eb8f059d1e010d5 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-environment.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-environment.md
@@ -1,18 +1,17 @@
# 目录环境能力
-
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
-```
+```js
import environment from '@ohos.environment';
```
+## 系统能力
-
-## 权限列表
-
-无
+SystemCapability.FileManagement.File.Environment
## environment.getStorageDataDir
@@ -28,7 +27,7 @@ getStorageDataDir():Promise<string>
- 示例:
- ```
+ ```js
environment.getStorageDataDir().then(function(path){
// do something
}).catch(function(error){
@@ -50,7 +49,7 @@ getStorageDataDir(callback:AsyncCallback<string>):void
- 示例:
- ```
+ ```js
environment.getStorageDataDir(function(error, path){
// do something
});
@@ -70,7 +69,7 @@ getUserDataDir():Promise<string>
- 示例:
- ```
+ ```js
environment.getUserDataDir().then(function(path){
// do something
}).catch(function(error){
@@ -92,7 +91,7 @@ getUserDataDir(callback:AsyncCallback<string>): void
- 示例:
- ```
+ ```js
environment.getUserDataDir(function(error, path){
// do something
});
diff --git a/zh-cn/application-dev/reference/apis/js-apis-filemanager.md b/zh-cn/application-dev/reference/apis/js-apis-filemanager.md
index 897f1063eadeedf1ce2acfbb392f85139d4e959a..173e64ef45ade4c21a26e7cd3346eebedf826fe6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-filemanager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-filemanager.md
@@ -1,16 +1,18 @@
# 公共文件访问与管理
-
+> **说明:**
+>本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
-```
+```js
import filemanager from 'ohos.filemanager'
```
-## 权限
+## 系统能力
-应用需要拥有SystemCapability.FileManagement.FileManagerService权限
+SystemCapability.FileManagement.FileManagerService
## filemanager.getRoot
+
getRoot(options? : {dev? : DevInfo}) : Promise<FileInfo[]>
以异步方法获取第一层相册,目录信息。使用promise形式返回结果。
@@ -18,13 +20,13 @@ getRoot(options? : {dev? : DevInfo}) : Promise<FileInfo[]>
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | -- |
- | dev | DevInfo | 否 | 设备名, 当前仅支持设备'local' |
+ | dev | [DevInfo](#devinfo) | 否 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
- 返回值
| 类型 | 说明 |
| --- | -- |
- | Promise<FileInfo[]> | 第一层目录相册信息 |
+ | Promise<[FileInfo](#fileinfo)[]> | 第一层目录相册信息 |
- 示例
@@ -52,8 +54,8 @@ getRoot(options? : {dev? : DevInfo}, callback : AsyncCallback<FileInfo[]>)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ----------------------------- |
- | dev | DevInfo | 否 | 设备名, 当前仅支持设备'local' |
- | callback | AsyncCallback<FileInfo[]> | 是 | 异步获取文件的信息之后的回调 |
+ | dev | [DevInfo](#devinfo) | 否 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
+ | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | 是 | 异步获取文件的信息之后的回调 |
- 示例
@@ -78,10 +80,10 @@ listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : num
| --- | --- | --- | -- |
| type | string | 是 | 待查询文件类型, 支持以下类型 "file", "image", "audio", "video" |
| path | string | 是 | 待查询目录uri |
- | dev | DevInfo | 是 | 设备名, 当前仅支持设备'local' |
+ | dev | [DevInfo](#devinfo) | 是 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
| offset | number | 否 | 待查询文件偏移 |
| count | number | 否 | 待查询文件个数 |
-
+
- 返回值
| 类型 | 说明 |
@@ -123,10 +125,10 @@ listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : num
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 待查询文件类型, 支持以下类型 "file", "image", "audio", "video" |
| path | string | 是 | 待查询目录uri |
- | dev | DevInfo | 否 | 设备名, 当前仅支持设备'local' |
+ | dev | [DevInfo](#devinfo) | 否 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
| offset | number | 否 | 待查询文件偏移 |
| count | number | 否 | 待查询文件个数 |
- | callback | AsyncCallback<FileInfo[]> | 是 | 异步获取文件的信息之后的回调 |
+ | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | 是 | 异步获取文件的信息之后的回调 |
- 异常
| 错误名称 | 错误类型 | 错误码 | 说明 |
@@ -158,7 +160,7 @@ filemanager.createFile(path : string, filename : string, options? : {dev? : DevI
| --- | --- | --- | -- |
| filename | string | 是 | 待创建的文件名 |
| path | string | 是 | 待保存目的相册uri |
- | dev | DevInfo | 否 | 设备名, 当前仅支持设备'local' |
+ | dev | [DevInfo](#devinfo) | 否 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
- 返回值
@@ -199,8 +201,8 @@ createFile(path : string, filename: string, options? : {dev? : DevInfo}, callbac
| -------- | ------------------------- | ---- | ----------------------------- |
| filename | string | 是 | 待创建的文件名 |
| path | string | 是 | 待保存目的相册uri |
- | dev | DevInfo | 否 | 设备名, 当前仅支持设备'local' |
- | callback | AsyncCallback<FileInfo[]> | 是 | 异步获取文件的信息之后的回调 |
+ | dev | [DevInfo](#devinfo) | 否 | 设备名, 不填为默认值dev = {name: "local"}, 当前仅支持设备'local' |
+ | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | 是 | 异步获取文件的信息之后的回调 |
- 异常
@@ -225,6 +227,8 @@ filemanager.createFile(media_path, name, (err, uri) => {
## FileInfo
文件信息类型,通过getRoot, listFile等接口返回的类型。
+### 属性
+
| 参数名 | 类型 | 可读 | 可写 | 说明 |
| --- | -- | -- | -- | -- |
| name | string | 是 | 否 | 文件名称 |
@@ -237,6 +241,8 @@ filemanager.createFile(media_path, name, (err, uri) => {
## DevInfo
设备类型,配置接口访问的设备类型。
+### 属性
+
| 参数名 | 类型 | 可读 | 可写 | 说明 |
| --- | -- | -- | -- | -- |
| name | string | 是 | 是 | 设备名称 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-hashmap.md b/zh-cn/application-dev/reference/apis/js-apis-hashmap.md
new file mode 100644
index 0000000000000000000000000000000000000000..bb8b631ed02837a7645134a62a985e162db24b10
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-hashmap.md
@@ -0,0 +1,380 @@
+# 非线性容器HashMap
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {HashMap} from '@ohos.util.HashMap'
+```
+
+
+## 权限
+
+无
+
+## HashMap
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | HashMap的元素个数 |
+
+
+### constructor
+
+constructor();
+
+HashMap的构造函数。
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该HashMap是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const hashMap = new HashMap();
+ hashMap.isEmpty();
+ ```
+
+
+### hasKey
+
+hasKey(key: K): boolean;
+
+判断此HashMap中是否含有该指定key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### hasValue
+
+hasValue(value: V): boolean;
+
+判断此HashMap中是否含有该指定value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.hasValue(123);
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.hasValue(123);
+ ```
+
+
+### get
+
+get(key: K): V;
+
+获取指定key所对应的value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 查找的指定key |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回key映射的value值 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ hashMap.get("sdfs");
+ ```
+
+
+### setAll
+
+setAll(map: HashMap): void;
+
+将一个HashMap中的所有元素组添加到另一个hashmap中。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | map | HashMap | 是 | 被添加元素的hashmap |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ let newHashMap = new HashMap();
+ hashMap.setAll(newHashMap);
+ ```
+
+
+### set
+
+set(key: K, value: V): Object;
+
+向HashMap中添加一组数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 添加成员数据的键名 |
+ | value | V | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Object | 返回添加后的hashmap |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ ```
+
+
+### remove
+
+remove(key: K): V;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 依据key指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回删除元素的值 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ hashMap.remove("sdfs");
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除HashMap中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ hashMap.clear();
+ ```
+
+
+### keys
+
+keys(): IterableIterator<K>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<K> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ let iter = hashMap.keys();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### values
+
+values(): IterableIterator<V>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<V> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ let iter = hashMap.values();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### replace
+
+replace(key: K, value: V): boolean;
+
+对HashMap中一组数据进行更新(替换)。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 依据key指定替换的元素 |
+ | value | V | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否成功对已有数据进行替换 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("sdfs", 123);
+ hashMap.replace("sdfs", 357);
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: V, key?: K, hashMap?: HashMap) => void, thisArg?: Object): void;
+
+通过回调函数来遍历HashMap实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 当前遍历到的元素键值对的值 |
+ | key | K | 是 | 当前遍历到的元素键值对的键 |
+ | hashMap | HashMap | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("sdfs", 123);
+ hashMap.set("dfsghsf", 357);
+ hashMap.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### entries
+
+entries(): IterableIterator<[K, V]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+ let iter = hashMap.entries();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<[K, V]>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashMap = new HashMap();
+ hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ hashMap.set("sdfs", 356);
+
+ // 使用方法一:
+ for (let item of hashMap) {
+ console.log("key: " + item[0]);
+ console.log("value: " + item[1]);
+ }
+
+ // 使用方法二:
+ let iter = hashMap[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-hashset.md b/zh-cn/application-dev/reference/apis/js-apis-hashset.md
new file mode 100644
index 0000000000000000000000000000000000000000..cf0a8fcfc2ef15b87c88ddb89e6a7019609711c5
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-hashset.md
@@ -0,0 +1,256 @@
+# 非线性容器HashSet
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {HashSet} from '@ohos.util.HashSet'
+```
+
+
+## 权限
+
+无
+
+## HashSet
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | HashSet的元素个数 |
+
+
+### constructor
+
+constructor();
+
+HashSet的构造函数。
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该HashSet是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const hashSet = new HashSet();
+ hashSet.isEmpty();
+ ```
+
+
+### has
+
+has(value: T): boolean;
+
+判断此HashSet中是否含有该指定key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### add
+
+add(value: T): boolean;
+
+向HashSet中添加数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 添加成员数据 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 返回是否有成功增加元素 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### remove
+
+remove(value: T): boolean;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 返回是否成功删除指定元素 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("sdfs");
+ hashSet.remove("sdfs");
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除HashSet中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("sdfs");
+ hashSet.clear();
+ ```
+
+
+### values
+
+values(): IterableIterator<T>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("sdfs");
+ let iter = hashSet.values();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: T, key?: T, hashSet?: HashSet<T>) => void, thisArg?: Object): void;
+
+通过回调函数来遍历实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素键值对的值 |
+ | key | T | 否 | 当前遍历到的元素键值对的值(和value相同) |
+ | hashSet | HashSet<T> | 否 | 当前调用forEach方法的实例对象 |
+
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("sdfs");
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### entries
+entries(): IterableIterator<[T, T]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[T, T]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("sdfs");
+ let iter = hashSet.entries();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let hashSet = new HashSet();
+ hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ hashSet.add("sdfs");
+
+ // 使用方法一:
+ for (let item of hashSet) {
+ console.log("value: " + item);
+ }
+
+ // 使用方法二:
+ let iter = hashSet[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md b/zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md
new file mode 100644
index 0000000000000000000000000000000000000000..81af9fe3a0b734117c1324415d2119f0ee0e644a
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md
@@ -0,0 +1,551 @@
+# 非线性容器LightWeightMap
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {LightWeightMap} from '@ohos.util.LightWeightMap'
+```
+
+
+## 权限
+
+无
+
+## LightWeightMap
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | LightWeightMap的元素个数 |
+
+
+### constructor
+
+constructor();
+
+LightWeightMap的构造函数。
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该LightWeightMap是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const lightWeightMap = new LightWeightMap();
+ lightWeightMap.isEmpty();
+ ```
+
+
+### hasAll
+
+hasAll(map: LightWeightMap): boolean;
+
+判断此LightWeightMap中是否含有该指定map中的所有元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | map | LightWeightMap | 是 | 比较对象 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含所有元素 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ let map = new LightWeightMap();
+ map.set("sdfs", 356);
+ let result = lightWeightMap.hasAll(map);
+ ```
+
+
+### hasKey
+
+hasKey(key: K): boolean;
+
+判断此LightWeightMap中是否含有该指定key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### hasValue
+
+hasValue(value: V): boolean;
+
+判断此LightWeightMap中是否含有该指定value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.hasValue(123);
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.hasValue(123);
+ ```
+
+
+### increaseCapacityTo
+
+increaseCapacityTo(minimumCapacity: number): void;
+
+将当前LightWeightMap扩容至可以容纳指定数量元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | minimumCapacity | number | 是 | 需要容纳数量 |
+
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.increaseCapacityTo(10);
+ ```
+
+
+### get
+
+get(key: K): V;
+
+获取指定key所对应的value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 查找的指定key |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回key映射的value值 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.get("sdfs");
+ ```
+
+
+### getIndexOfKey
+
+getIndexOfKey(key: K): number;
+
+查找指定元素第一次出现的下标值,如果没有找到该元素返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 被查找的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.getIndexOfKey("sdfs");
+ ```
+
+
+### getIndexOfValue
+
+getIndexOfValue(value: V): number;
+
+查找指定元素第一次出现的下标值,如果没有找到该元素返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 被查找的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.getIndexOfValue(123);
+ ```
+
+
+### getKeyAt
+
+getKeyAt(index: number): K;
+
+查找指定下标的元素键值对中key值,否则返回undefined。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 所查找的下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | K | 返回该下标对应的元素键值对中key值 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.getKeyAt(1);
+ ```
+
+
+### setAll
+
+setAll(map: LightWeightMap): void;
+
+将一个LightWeightMap中的所有元素组添加到另一个lightweightmap中。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | map | LightWeightMap | 是 | 被添加元素的lightweightmap |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ let map = new LightWeightMap();
+ lightWeightMap.setAll(map);
+ ```
+
+
+### set
+set(key: K, value: V): Object;
+
+向LightWeightMap中添加一组数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 添加成员数据的键名 |
+ | value | V | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Object | 返回添加后的hashmap |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ ```
+
+
+### remove
+
+remove(key: K): V;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 依据key指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回删除元素的值 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.remove("sdfs");
+ ```
+
+
+### removeAt
+
+removeAt(index: number): boolean;
+
+删除指定下标的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定想要删除元素下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 确认是否成功删除元素 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.removeAt(1);
+ ```
+
+
+### setValueAt
+
+setValueAt(index: number, newValue: V): boolean;
+
+向LightWeightMap中具体位置替换键值对中的值。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定替换数据下标 |
+ | newValue | V | 是 | 替换键值对中的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否成功替换指定位置数据 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.setValueAt(1, 3546);
+ ```
+
+
+### getValueAt
+
+getValueAt(index: number): V;
+
+获取LightWeightMap中具体位置键值对中的值。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定查询数据下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回指定位置中键值对的值 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.getValueAt(1);
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除LightWeightMap中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ lightWeightMap.clear();
+ ```
+
+
+### keys
+
+keys(): IterableIterator<K>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<K> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ let iter = lightWeightMap.keys();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### values
+
+values(): IterableIterator<V>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<V> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ let iter = lightWeightMap.values();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: V, key?: K, lightWeightMap?: LightWeightMap) => void, thisArg?: Object): void;
+
+通过回调函数来遍历实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 当前遍历到的元素键值对的值 |
+ | key | K | 是 | 当前遍历到的元素键值对的键 |
+ | lightWeightMap | LightWeightMap | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("sdfs", 123);
+ lightWeightMap.set("dfsghsf", 357);
+ lightWeightMap.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### entries
+
+entries(): IterableIterator<[K, V]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+ let iter = lightWeightMap.entries();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<[K, V]>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightMap = new LightWeightMap();
+ lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ lightWeightMap.set("sdfs", 356);
+
+ // 使用方法一:
+ for (let item of lightWeightMap) {
+ console.log("key: " + item[0]);
+ console.log("value: " + item[1]);
+ }
+
+ // 使用方法二:
+ let iter = lightWeightMap[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md b/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md
new file mode 100644
index 0000000000000000000000000000000000000000..8f31ac5037df748bfe566232281d937ab089a146
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md
@@ -0,0 +1,463 @@
+# 非线性容器LightWeightSet
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {LightWeightSet} from '@ohos.util.LightWeightSet'
+```
+
+
+## 权限
+
+无
+
+## LightWeightSet
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | LightWeightSet的元素个数 |
+
+
+### constructor
+
+constructor();
+
+LightWeightSet的构造函数。
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该容器是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const lightWeightSet = new LightWeightSet();
+ lightWeightSet.isEmpty();
+ ```
+
+### add
+
+add(value: T): boolean;
+
+向此容器中添加数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 添加的成员数据 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否成功添加元素 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### addAll
+
+addAll(set: LightWeightSet<T>): boolean;
+
+将另一个容器中的所有元素组添加到当前容器中。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | set | LightWeightSet<T> | 是 | 提供添加元素的lightweightmap |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ let set = new LightWeightSet();
+ set.add("sfage");
+ lightWeightSet.addAll(set);
+ ```
+
+
+### hasAll
+
+hasAll(set: LightWeightSet<T>): boolean;
+
+判断此容器中是否含有该指定set中的所有元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | set | LightWeightSet<T> | 是 | 比较对象 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含所有元素 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ let set = new LightWeightSet();
+ set.add("sdfs");
+ let result = lightWeightSet.hasAll(set);
+ ```
+
+
+### has
+
+has(value: T): boolean;
+
+判断此容器中是否含有该指定value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.has(123);
+ lightWeightSet.add(123);
+ lightWeightSet.has(123);
+ ```
+
+
+### equal
+
+equal(obj: Object): boolean;
+
+判断此容器中是否含有该指定obj同类型。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | obj | Object | 是 | 比较对象 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否构成类型相同 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ let obj = {"Ahfbrgrbgnutfodgorrogorgrogofdfdf", "sdfs"};
+ let result = lightWeightSet.equal(obj);
+ ```
+
+
+### ensureCapacityTo
+
+ensureCapacityTo(minimumCapacity: number): void;
+
+将当前容器扩容至可以容纳指定数量元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | minimumCapacity | number | 是 | 需要容纳数量 |
+
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.ensureCapacityTo(10);
+ ```
+
+
+### getIndexOf
+
+getIndexOf(key: T): number;
+
+获取指定key所对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | T | 是 | 查找的指定key |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 在lightweightset中指定数据的下标 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.getIndexOf("sdfs");
+ ```
+
+
+### remove
+
+remove(key: T): T;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | T | 是 | 依据key指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除元素的值 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.remove("sdfs");
+ ```
+
+
+### removeAt
+
+removeAt(index: number): boolean;
+
+删除指定下标的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定想要删除元素下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 确认是否成功删除元素 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.removeAt(1);
+ ```
+
+
+### getValueAt
+
+getValueAt(index: number): T;
+
+获取此容器中具体位置的元素
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定查询数据下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回指定位置中元素 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.getValueAt(1);
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除容器中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.clear();
+ ```
+
+
+### toString
+
+toString(): String;
+
+获取包含容器中所有键和值的字符串。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | String | 返回一个字符串 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.toString();
+ ```
+
+
+### toArray
+
+toArray(): Array<T>;
+
+获取包含此容器中所有对象的数组。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Array<T> | 返回一个数组 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ lightWeightSet.toString();
+ ```
+
+
+### values
+
+values(): IterableIterator<T>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ let iter = lightWeightSet.values();
+ let index = 0;
+ while(index < lightWeightSet.length) {
+ console.log(JSON.stringify(iter.next().value));
+ index++;
+ }
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: T, key?: T, lightWeightSet?: LightWeightSet<T>) => void, thisArg?: Object): void;
+
+通过回调函数来遍历LightWeightSet实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | key | T | 否 | 当前遍历到的元素(和value相同) |
+ | lightWeightSet | LightWeightSet<T> | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("sdfs");
+ lightWeightSet.add("dfsghsf");
+ lightWeightSet.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### entries
+
+entries(): IterableIterator<[T, T]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[T, T]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+ let iter = lightWeightSet.entries();
+ let index = 0;
+ while(index < lightWeightSet.length) {
+ console.log(JSON.stringify(iter.next().value));
+ index++;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let lightWeightSet = new LightWeightSet();
+ lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ lightWeightSet.add("sdfs");
+
+ // 使用方法一:
+ for (let item of lightWeightSet) {
+ console.log("value: " + item);
+ }
+
+ // 使用方法二:
+ let iter = lightWeightSet[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md b/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md
new file mode 100644
index 0000000000000000000000000000000000000000..8c8cd37ffd6d1da955c8dac7134b751bb2fa2b7a
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md
@@ -0,0 +1,551 @@
+# 线性容器LinkedList
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {LinkedList} from '@ohos.util.LinkedList'
+```
+
+
+## 权限
+
+无
+
+
+## LinkedList
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | LinkedList的元素个数 |
+
+
+### constructor
+
+constructor(_head?: NodeObj<T>, _tail?: NodeObj<T>);
+
+LinkedList的构造函数。
+
+- 参数:
+ | 参数名 | 类型 | 可读 | 可写 | 说明 |
+ | -------- | -------- | -------- | -------- | -------- |
+ | _head | NodeObj<T> | 是 | 否 | 入参对象,节点对象,含有element,和next指向,和prev指向 |
+ | _tail | NodeObj<T> | 是 | 否 | 入参对象,节点对象,含有element,和next指向,和prev指向 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ ```
+
+
+### add
+
+add(element: T): boolean;
+
+在LinkedList尾部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 插入成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add("a");
+ linkedList.add(1);
+ let b = [1, 2, 3];
+ linkedList.add(b);
+ let c = {name : "lala", age : "13"};
+ linkedList.add(false);
+ ```
+### addFirst
+
+addFirst(element: T): void;
+
+在LinkedList头部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.addFirst("a");
+ linkedList.addFirst(1);
+ let b = [1, 2, 3];
+ linkedList.addFirst(b);
+ let c = {name : "lala", age : "13"};
+ linkedList.addFirst(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void;
+
+在长度范围内任意插入指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 被插入的元素 |
+ | index | number | 是 | 被插入的位置索引 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.insert("A", 0);
+ linkedList.insert(0, 1);
+ linkedList.insert(true, 2);
+ ```
+
+### has
+
+has(element: T): boolean;
+
+判断此LinkedList中是否含有该指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.has("Ahfbrgrbgnutfodgorrogorg");
+ linkedList.add("Ahfbrgrbgnutfodgorrogorg");
+ linkedList.has("Ahfbrgrbgnutfodgorrogorg");
+ ```
+
+### get
+
+get(index: number): T;
+
+根据下标获取LinkedList中的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定的下标值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 根据下标查找到的元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(1);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.get(2);
+ ```
+### getLastIndexOf
+
+getLastIndexOf(element: T): number;
+
+返回指定元素最后一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素最后一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(1);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.getLastIndexOf(2);
+ ```
+
+### getIndexOf
+
+getIndexOf(element: T): number;
+
+返回指定元素第一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(1);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.getIndexOf(2);
+ ```
+### removeByIndex
+
+removeByIndex(index: number): T;
+
+根据元素的下标值查找元素,返回元素后将其删除。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定元素的下标值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.removeByIndex(2);
+ ```
+### removeFirst
+
+removeFirst(): T;
+
+删除并返回LinkedList的第一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.removeFirst();
+ ```
+### removeLast
+
+removeLst(): T;
+
+删除并返回LinkedList的最后一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.removeLast();
+ ```
+
+### remove
+
+remove(element: T): boolean;
+
+删除查找到的第一个指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.remove(2);
+ ```
+### removeFirstFound
+
+removeFirstFound(element: T): boolean;
+
+删除第一次出现的指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.removeFirstFound(4);
+ ```
+### removeLastFound
+
+removeLastFound(element: T): boolean;
+
+删除最后一次出现的指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.removeLastFound(4);
+ ```
+### clone
+clone(): LinkedList<T>;
+
+克隆一个与LinkedList一模一样的实例,并返回克隆后的实例,修改克隆后的实例并不会影响原实例。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | LinkedList<T> | 返回LinkedList对象实例 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.clone();
+ ```
+### forEach
+forEach(callbackfn: (value: T, index?: number, linkedlist?: LinkedList<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历LinkedList实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | linkedlist | LinkedList<T> | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.forEach((value, index) => {
+ console.log(value, index);
+ });
+ ```
+### clear
+clear(): void;
+
+清除LinkedList中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.clear();
+ ```
+### set
+set(index: number, element: T): T;
+将此 LinkedList 中指定位置的元素替换为指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 查找的下标值 |
+ | element | T | 是 | 用来替换的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T类型 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.set(2, "b");
+ ```
+### convertToArray
+convertToArray(): Array<T>;
+
+把当前LinkedList实例转换成数组,并返回转换后的数组。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Array<T> | 返回数组类型 |
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.convertToArray();
+ ```
+
+### getFirst
+
+getFirst(): T;
+获取LinkedList实例中的第一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.getFirst();
+ ```
+### getLast
+
+getLast(): T;
+获取LinkedList实例中的最后一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+ linkedList.getLast();
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器。 |
+
+
+- 示例:
+ ```
+ let linkedList = new LinkedList();
+ linkedList.add(2);
+ linkedList.add(4);
+ linkedList.add(5);
+ linkedList.add(4);
+
+ // 使用方法一:
+ for (let item of linkedList) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = linkedList[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-list.md b/zh-cn/application-dev/reference/apis/js-apis-list.md
new file mode 100644
index 0000000000000000000000000000000000000000..03a5b0e01e1497c7346c2b1c01c808c78bc2c9a7
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-list.md
@@ -0,0 +1,561 @@
+# 线性容器List
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {List} from '@ohos.util.List'
+```
+
+
+## 权限
+
+无
+
+
+## List
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | List的元素个数 |
+
+
+### constructor
+
+constructor(_head?: NodeObj<T>);
+
+List的构造函数。
+
+- 参数:
+ | 参数名 | 类型 | 可读 | 可写 | 说明 |
+ | -------- | -------- | -------- | -------- | -------- |
+ | _head | NodeObj<T> | 是 | 否 | 入参对象,节点对象,含有element,和next指向 |
+
+- 示例:
+ ```
+ let list = new List();
+ ```
+
+
+### add
+
+add(element: T): boolean;
+
+在List尾部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 插入成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let list = new List;
+ list.add("a");
+ list.add(1);
+ let b = [1, 2, 3];
+ list.add(b);
+ let c = {name : "lala", age : "13"};
+ list.add(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void;
+
+在长度范围内任意位置插入指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 被插入的元素 |
+ | index | number | 是 | 被插入的位置索引 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.insert("A", 0);
+ list.insert(0, 1);
+ list.insert(true, 2);
+ ```
+
+### has
+
+has(element: T): boolean;
+
+判断此List中是否含有该指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.has("Ahfbrgrbgnutfodgorrogorg");
+ list.add("Ahfbrgrbgnutfodgorrogorg");
+ list.has("Ahfbrgrbgnutfodgorrogorg");
+ ```
+
+### get
+
+get(index: number): T;
+
+根据下标获取List中的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 要查找的下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 根据下标查找到的元素 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(2);
+ list.add(1);
+ list.add(2);
+ list.add(4);
+ list.get(2);
+ ```
+### getLastIndexOf
+
+getLastIndexOf(element: T): number;
+
+查找指定元素最后一次出现的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 查找指定元素最后一次出现的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(2);
+ list.add(1);
+ list.add(2);
+ list.add(4);
+ list.getLastIndexOf(2);
+ ```
+
+### getIndexOf
+
+getIndexOf(element: T): number;
+
+查找指定元素第一次出现的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回第一次找到指定元素的下标,没有找到返回-1 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(2);
+ list.add(1);
+ list.add(2);
+ list.add(4);
+ list.getIndexOf(2);
+ ```
+
+### equal
+
+equal(obj: Object): boolean;
+
+比较指定对象与此List是否相等。如果对象与此列表相同,返回true,否则返回false。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | obj | Object | 是 | 用来比较的对象 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 返回boolean类型 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(2);
+ let obj1 = new List();
+ obj1.add(2);
+ obj1.add(4);
+ obj1.add(5);
+ list.equal(obj1);
+ let obj2 = {name : "lala", age : "13"};
+ list.equal(obj2);
+ ```
+### removeByIndex
+
+removeByIndex(index: number): T;
+
+根据元素的下标值查找元素,返回元素后将其删除。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定元素的下标值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(2);
+ list.add(4);
+ list.removeByIndex(2);
+ ```
+
+### remove
+
+remove(element: T): boolean;
+
+删除查找到的第一个指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.remove(2);
+ ```
+
+### replaceAllElements
+replaceAllElements(callbackfn: (value: T, index?: number, list?: List<T>) => T,
+thisArg?: Object): void;
+
+用户操作List中的元素,用操作后的元素替换原元素并返回操作后的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | list | List<T> | 否 | 当前调用replaceAllElements方法的实例对象 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.replaceAllElements((value, index) => {
+ return value = 2 * value;
+ });
+ list.replaceAllElements((value, index) => {
+ return value = value - 2;
+ });
+ ```
+### forEach
+forEach(callbackfn: (value: T, index?: number, list?: List<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历List实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素。 |
+ | index | number | 否 | 当前遍历到的下标值。 |
+ | list | List<T> | 否 | 当前调用forEach方法的实例对象 |
+
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.forEach((value, index) => {
+ console.log(value, index);
+ });
+
+ ```
+### sort
+sort(comparator: (firstValue: T, secondValue: T) => number): void;
+
+对List中的元素进行一个排序操作。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | comparator | function | 是 | 回调函数。 |
+
+- comparator的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | firstValue | T | 是 | 前一项元素 |
+ | secondValue | T | 是 | 后一项元素 |
+
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.sort(a, (b => a - b));
+ list.sort(a, (b => b - a));
+ ```
+### getSubList
+getSubList(fromIndex: number, toIndex: number): List<T>;
+
+根据下标截取List中的一段元素,并返回这一段List实例,包括起始值但不包括终止值。
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | fromIndex | number | 是 | 起始下标 |
+ | toIndex | number | 是 | 终止下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | List<T> | 返回List对象实例 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.subList(2, 4);
+ list.subList(4, 3);
+ list.subList(2, 6);
+ ```
+
+### clear
+clear(): void;
+
+清除List中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.clear();
+ ```
+### set
+set(index: number, element: T): T;
+将此 List 中指定位置的元素替换为指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 查找的下标值 |
+ | element | T | 是 | 用来替换的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T类型 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.set(2, "b");
+
+ ```
+### convertToArray
+convertToArray(): Array<T>;
+
+把当前List实例转换成数组,并返回转换后的数组。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Array<T> | 返回数组类型 |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.convertToArray();
+ ```
+### isEmpty
+isEmpty(): boolean;
+
+判断该List是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.isEmpty();
+ ```
+### getFirst
+
+getFirst(): T;
+获取List实例中的第一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let list = new Vector();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.getFirst();
+ ```
+### getLast
+
+getLast(): T;
+获取List实例中的最后一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let list = new Vector();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+ list.getLast();
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器。 |
+
+
+- 示例:
+ ```
+ let list = new List();
+ list.add(2);
+ list.add(4);
+ list.add(5);
+ list.add(4);
+
+ // 使用方法一:
+ for (let item of list) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = list[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-plainarray.md b/zh-cn/application-dev/reference/apis/js-apis-plainarray.md
new file mode 100644
index 0000000000000000000000000000000000000000..0c56ffe5dac2e3e85662a92c520ab6d27be776e5
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-plainarray.md
@@ -0,0 +1,421 @@
+# 非线性容器PlainArray
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {PlainArray} from '@ohos.util.PlainArray'
+```
+
+
+## 权限
+
+无
+
+## PlainArray
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | PlainArray的元素个数 |
+
+
+### constructor
+
+constructor();
+
+PlainArray的构造函数。
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该容器是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const plainArray = new PlainArray();
+ plainArray.isEmpty();
+ ```
+
+
+### has
+
+has(key: number): boolean;
+
+判断此容器中是否含有该指定key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | number | 是 | 查询的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.has(1);
+ plainArray.add(1, "sddfhf");
+ plainArray.has(1);
+ ```
+
+
+### get
+
+get(key: number): T;
+
+获取指定key所对应的value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | number | 是 | 查找的指定key |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回key映射的value值 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.get(1);
+ ```
+
+
+### getIndexOfKey
+
+getIndexOfKey(key: number): number;
+
+查找指定元素第一次出现的下标值,如果没有找到该元素返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | number | 是 | 被查找的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.getIndexOfKey("sdfs");
+ ```
+
+
+### getIndexOfValue
+
+getIndexOfValue(value: T): number;
+
+查找指定元素第一次出现的下标值,如果没有找到该元素返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 被查找的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.getIndexOfValue("sddfhf");
+ ```
+
+
+### getKeyAt
+
+getKeyAt(index: number): number;
+
+查找指定下标的元素键值对中key值,否则返回undefined。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 所查找的下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回该下标对应的元素键值对中key值 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.getKeyAt(1);
+ ```
+
+
+### clone
+
+clone(): PlainArray<T>;
+
+克隆一个一模一样的实例,并返回克隆后的实例,修改克隆后的实例并不会影响原实例。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | PlainArray<T> | 返回新的对象实例 |
+
+- 示例:
+ ```
+ let plainArray = new ArrayList();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ let newPlainArray = plainArray.clone();
+ ```
+
+
+### add
+
+add(key: number, value: T): boolean;
+
+向容器中添加一组数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | number | 是 | 添加成员数据的键名 |
+ | value | T | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 确认是否成功添加 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ ```
+
+
+### remove
+
+remove(key: number): T;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | number | 是 | 依据key指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除元素的值 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.remove(2);
+ ```
+
+
+### removeAt
+
+removeAt(index: number): boolean;
+
+删除指定下标的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定想要删除元素下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 确认是否成功删除元素 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.removeAt(1);
+ ```
+
+
+### removeRangeFrom
+
+removeRangeFrom(index: number, size: number): number;
+
+删除一定范围内的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 删除元素的起始下标 |
+ | size | number | 是 | 期望删除元素个数 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 实际删除元素个数 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.removeAt(1, 3);
+ ```
+
+
+### setValueAt
+
+setValueAt(index: number, newValue: T): void;
+
+向容器中具体位置替换键值对中的值。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定替换数据下标 |
+ | newValue | T | 是 | 替换键值对中的值 |
+
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.setValueAt(1, 3546);
+ ```
+
+
+### toString
+
+toString(): String;
+
+获取包含容器中所有键和值的字符串。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | String | 返回一个字符串 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.toString();
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除容器中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.clear();
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: T, key?: number, plainArray?: PlainArray) => void, thisArg?: Object): void;
+
+通过回调函数来遍历实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素键值对的值 |
+ | key | number | 是 | 当前遍历到的元素键值对的键 |
+ | plainArray | PlainArray | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+ plainArray.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<[number, T]>;
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[number, T]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let plainArray = new PlainArray();
+ plainArray.add(1, "sddfhf");
+ plainArray.add(2, "sffdfhf");
+
+ // 使用方法一:
+ for (let item of plainArray) {
+ console.log("index: " + item[0]);
+ console.log("value: " + item[1]);
+ }
+
+ // 使用方法二:
+ let iter = plainArray[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-power.md b/zh-cn/application-dev/reference/apis/js-apis-power.md
index 8304b440be0a7fa40c3be3af046863b6cb2da3af..281e065072a9cbd418ab2755255613665be337b9 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-power.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-power.md
@@ -10,14 +10,9 @@
import power from '@ohos.power';
```
+## 系统能力
-## 权限
-
-关机权限: ohos.permission.SHUTDOWN
-
-重启权限: ohos.permission.REBOOT
-
-重启并进入recovery模式的权限:ohos.permission.REBOOT_RECOVERY
+SystemCapability.PowerManager.PowerManager
## power.shutdownDevice
@@ -26,6 +21,8 @@ shutdownDevice(reason: string): void
系统关机。
+需要权限:ohos.permission.SHUTDOWN
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -44,6 +41,8 @@ rebootDevice(reason: string): void
重启设备。
+需要权限:ohos.permission.REBOOT(重启权限)、ohos.permission.REBOOT_RECOVERY(重启并进入recovery模式的权限)
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-process.md b/zh-cn/application-dev/reference/apis/js-apis-process.md
index 5aa3245c385bfbaa6d6f190ec708844dbc5ec51f..1c6b6523c02888233aab036de160305b5b7bcdf6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-process.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-process.md
@@ -11,11 +11,6 @@ import process from '@ohos.process';
```
-## 权限
-
-无
-
-
## 属性
| 名称 | 类型 | 可读 | 可写 | 说明 |
@@ -143,12 +138,12 @@ kill函数用来发送信号给子进程,结束指定进程。
isIsolatedProcess(): boolean
-检查进程是否被隔离。
+判断进程是否被隔离。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | boolean | 进程是否隔离 |
+ | boolean | 返回判断结果,如果返回true表示进程被隔离。 |
- 示例:
```
@@ -160,17 +155,17 @@ isIsolatedProcess(): boolean
isAppUid(v:number): boolean
-判断是否特定程序的uid。
+判断uid是否属于应用程序。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | v | number | 是 | 进程的id。 |
+ | v | number | 是 | 应用程序的uid。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | boolean | 是否是当前app的uid |
+ | boolean | 返回判断结果,如果返回true表示为应用程序的uid。|
- 示例:
```
@@ -182,12 +177,12 @@ isAppUid(v:number): boolean
is64Bit(): boolean
-判断运行环境是不是64位。
+判断运行环境是否64位。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | boolean | 是不是64位环境 |
+ | boolean | 返回判断结果,如果返回true表示为64位环境。 |
- 示例:
```
@@ -204,12 +199,12 @@ getUidForName(v:string): number
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | v | string | 是 | 进程name |
+ | v | string | 是 | 进程名。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 进程的uid |
+ | number | 返回进程uid。|
- 示例:
```
@@ -221,17 +216,17 @@ getUidForName(v:string): number
getThreadPriority(v:number): number
-根据指定的 TID 获取线程优先级。
+根据指定的tid获取线程优先级。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | v | number | 是 | 进程的id |
+ | v | number | 是 | 指定的线程tid。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 进程的优先级 |
+ | number | 返回线程的优先级。 |
- 示例:
```
@@ -249,7 +244,7 @@ getStartRealtime() :number
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 时间 |
+ | number | 返回经过的实时时间。|
- 示例:
```
@@ -261,12 +256,12 @@ getStartRealtime() :number
getAvailableCores() :number[]
-获取多核设备上当前进程可用的 CPU 内核。
+获取多核设备上当前进程可用的CPU内核。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number[] | 可用内核数 |
+ | number[] | 返回可用内核数。 |
- 示例:
```
@@ -283,7 +278,7 @@ getPastCputime() :number
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 时间 |
+ | number | 返回经过的CPU时间。 |
- 示例:
```
@@ -295,17 +290,17 @@ getPastCputime() :number
getSystemConfig(name:number): number
-用该方法发送signal到指定的进程。
+获取系统配置信息。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | name | number | 是 | 系统配置参数名 |
+ | name | number | 是 | 指定系统配置参数名。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 配置信息 |
+ | number | 返回系统配置信息。 |
- 示例:
```
@@ -323,12 +318,12 @@ getEnvironmentVar(name:string): string
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | name | string | 是 | 环境名 |
+ | name | string | 是 | 环境变量名。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | string | 环境名对应的value |
+ | string | 返回环境变量名对应的value。 |
- 示例:
```
@@ -367,7 +362,7 @@ runCmd(command: string, options?: { timeout : number, killSignal :number | str
var result = child.wait();
child.getOutput.then(val=>{
console.log("child.getOutput = " + val);
- }
+ })
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-queue.md b/zh-cn/application-dev/reference/apis/js-apis-queue.md
new file mode 100644
index 0000000000000000000000000000000000000000..cef46e3686c6497b449ec7704a053b602d68695d
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-queue.md
@@ -0,0 +1,180 @@
+# 线性容器Queue
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {Queue} from '@ohos.util.Queue'
+```
+
+
+## 权限
+
+无
+
+
+## Queue
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | Queue的元素个数 |
+
+
+### constructor
+
+constructor();
+
+Queue的构造函数。
+
+
+- 示例:
+ ```
+ let queue = new Queue();
+ ```
+
+
+### add
+
+add(element: T): boolean;
+
+在队列尾部插入元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 插入成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let queue = new Queue();
+ queue.add("a");
+ queue.add(1);
+ let b = [1, 2, 3];
+ queue.add(b);
+ let c = {name : "lala", age : "13"};
+ queue.add(false);
+ ```
+
+### pop
+
+pop(): T
+
+删除头元素并返回该删除元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let queue = new Queue();
+ queue.add(2);
+ queue.add(4);
+ queue.add(5);
+ queue.add(2);
+ queue.add(4);
+ queue.pop();
+ ```
+
+### getFirst
+
+getFirst(): T;
+
+获取队列的头元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回尾元素 |
+
+- 示例:
+ ```
+ let queue = new Queue();
+ queue.add(2);
+ queue.add(4);
+ queue.add(5);
+ queue.add(2);
+ queue.getFirst();
+ ```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, queue?: Queue<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历Queue实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数。 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | queue | Queue<T> | 否 | 当前调用forEach方法的实例对象 |
+
+
+- 示例:
+ ```
+ let queue = new Queue();
+ queue.add(2);
+ queue.add(4);
+ queue.add(5);
+ queue.add(4);
+ queue.forEach((value, index) => {
+ console.log(value, index);
+ });
+
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+
+- 示例:
+ ```
+ let queue = new Queue();
+ queue.add(2);
+ queue.add(4);
+ queue.add(5);
+ queue.add(4);
+
+ // 使用方法一:
+ for (let item of queue) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = queue[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md b/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
index 302ec50fe59579adac4133cd9f5e41df1ce37536..5d634d453ea544c2eff9e67b164e41d6e4de6a1d 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
@@ -11,6 +11,11 @@ import reminderAgent from'@ohos.reminderAgent';
```
+## 系统能力
+
+SystemCapability.Notification.ReminderAgent
+
+
## 权限
ohos.permission.PUBLISH_AGENT_REMINDER
diff --git a/zh-cn/application-dev/reference/apis/js-apis-runninglock.md b/zh-cn/application-dev/reference/apis/js-apis-runninglock.md
index 887fa5eb22a99229226be3d13c70037e44d61318..c6f8ba213794bcd5398c20148c79624c45c3c698 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-runninglock.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-runninglock.md
@@ -11,9 +11,9 @@ import runninglock from '@ohos.runningLock';
```
-## 权限
+## 系统能力
-申请、使用锁的权限:ohos.permission.RUNNING_LOCK
+SystemCapability.PowerManager.PowerManager
## RunningLockType
@@ -84,6 +84,8 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l
创建RunningLock锁。
+需要权限:ohos.permission.RUNNING_LOCK
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -113,6 +115,8 @@ createRunningLock(name: string, type: RunningLockType): Promise<RunningLock&g
创建Runninglock锁。
+需要权限:ohos.permission.RUNNING_LOCK
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-security-accessToken.md b/zh-cn/application-dev/reference/apis/js-apis-security-accessToken.md
new file mode 100644
index 0000000000000000000000000000000000000000..09e204bff8581a44fd227abd2f98c0050a930ea4
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-security-accessToken.md
@@ -0,0 +1,216 @@
+# 访问控制管理
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+## 导入模块
+
+```
+import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
+```
+
+## 系统能力
+SystemCapability.Security.AccessToken
+
+## abilityAccessCtrl.createAtManager
+
+createAtManager(): AtManager
+
+访问控制管理:获取访问控制模块对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | [AtManager](#atManager) | 获取访问控制模块的实例。 |
+
+- 示例:
+ ```
+ var AtManager = abilityAccessCtrl.createAtManager();
+ ```
+
+## AtManager
+
+管理访问控制模块的实例。
+
+### verifyAccessToken
+
+verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStatus>
+
+校验应用是否授予权限,使用Promise方式异步返回结果。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | ------------------- | ---- | ------------------------------------------ |
+ | tokenID | number | 是 | 要校验的目标应用的身份标识。 |
+ | permissionName | string | 是 | 需要校验的权限名称。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | :------------ | :---------------------------------- |
+ | Promise<GrantStatus> | Promise实例,用于获取异步返回的授权状态结果。 |
+
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ let promise = AtManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
+ promise.then(data => {
+ console.log(`promise: data->${JSON.stringify(data)}`);
+ });
+ ```
+
+### grantUserGrantedPermission
+
+grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise<number>
+
+授予应用user grant权限,使用Promise方式异步返回结果。
+
+需要权限:ohos.permission.GRANT_SENSITIVE_PERMISSIONS。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------- | ---- | ------------------------------------------------------------ |
+ | tokenID | number | 是 | 目标应用的身份标识。 |
+ | permissionName | string | 是 | 被授予的权限名称。 |
+ | permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | :------------ | :---------------------------------- |
+ | Promise<number> | Promise实例,用于获取异步返回的授权操作结果。 |
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
+ promise.then(data => {
+ console.log(`promise: data->${JSON.stringify(data)}`);
+ });
+ ```
+
+
+
+### grantUserGrantedPermission
+
+grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback<number>): void
+
+授予应用user grant权限,使用callback回调异步返回结果。
+
+需要权限:ohos.permission.GRANT_SENSITIVE_PERMISSIONS。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------- | ---- | ------------------------------------------------------------ |
+ | tokenID | number | 是 | 目标应用的身份标识。 |
+ | permissionName | string | 是 | 被授予的权限名称。 |
+ | permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 |
+ | callback | AsyncCallback<number> | 是 | 检查授予应用user grant权限的操作结果同步的回调。 |
+
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ let permissionFlag = 1;
+ AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
+ });
+ ```
+
+### revokeUserGrantedPermission
+
+revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise<number>
+
+撤销应用user grant权限,使用Promise方式异步返回结果。
+
+需要权限:ohos.permission.REVOKE_SENSITIVE_PERMISSIONS。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------- | ---- | ------------------------------------------------------------ |
+ | tokenID | number | 是 | 目标应用的身份标识。 |
+ | permissionName | string | 是 | 被撤销的权限名称。 |
+ | permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | :------------ | :---------------------------------- |
+ | Promise<number> | Promise实例,用于获取异步返回的授权操作结果。 |
+
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ let permissionFlag = 1;
+ let promise = AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag);
+ promise.then(data => {
+ console.log(`promise: data->${JSON.stringify(data)}`);
+ });
+ ```
+
+### revokeUserGrantedPermission
+
+revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback<number>): void
+
+撤销应用user grant权限,使用callback回调异步返回结果。
+
+需要权限:ohos.permission.REVOKE_SENSITIVE_PERMISSIONS。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------- | ---- | ------------------------------------------------------------ |
+ | tokenID | number | 是 | 目标应用的身份标识。 |
+ | permissionName | string | 是 | 被撤销的权限名称。 |
+ | permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 |
+ | callback | AsyncCallback<number> | 是 | 检查撤销应用user grant权限的操作结果同步的回调。 |
+
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
+ });
+ ```
+
+### getPermissionFlags
+
+getPermissionFlags(tokenID: number, permissionName: string): Promise<number>
+
+获取指定应用的指定权限的flag,使用Promise方式异步返回结果。
+
+- 参数:
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | --------- | ------------------- | ---- | ------------------------------------------------------------ |
+ | tokenID | number | 是 | 目标应用的身份标识。 |
+ | permissionName | string | 是 | 查询的权限名称。 |
+
+- 返回值:
+
+ | 类型 | 说明 |
+ | :------------ | :---------------------------------- |
+ | Promise<number> | Promise实例,用于获取异步返回的查询结果。 |
+
+- 示例:
+
+ ```
+ const AtManager = abilityAccessCtrl.createAtManager();
+ let tokenID = 0;
+ let promise = AtManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
+ promise.then(data => {
+ console.log(`promise: data->${JSON.stringify(data)}`);
+ });
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-sensor.md
index 1abb59effb99cabfbb0111aef6c201f1b2448228..838641fb4ee7d5f08e671f789e9000f31f602164 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-sensor.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-sensor.md
@@ -10,6 +10,9 @@
import sensor from '@ohos.sensor';
```
+## 系统能力
+
+SystemCapability.Sensors.Sensor
## 权限列表
@@ -22,9 +25,9 @@ import sensor from '@ohos.sensor';
陀螺仪:ohos.permission.GYROSCOPE
-## sensor.on(SensorType.SENSOR_TYPE_ID_ACCELEROMETER)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER)
-on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<AccelerometerResponse>,options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<AccelerometerResponse>,options?: Options): void
监听加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -39,23 +42,23 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<Acc
- 示例:
```
- sensor.on(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info('X-coordinate component: ' + data.x);
+ console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- },
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION)
-on(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback<LinearAccelerometerResponse>, options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback<LinearAccelerometerResponse>, options?: Options): void
监听线性加速度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -68,23 +71,23 @@ on(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback<
- 示例:
```
- sensor.on(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER,function(error,data){
- if (error) {
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,function(error,data){
+ if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED)
-on(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallback<AccelerometerUncalibratedResponse>, options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallback<AccelerometerUncalibratedResponse>, options?: Options): void
监听未校准加速度计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -97,7 +100,7 @@ on(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallb
- 示例:
```
- sensor.on(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -108,15 +111,15 @@ on(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallb
console.info('X-coordinate bias: ' + data.biasX);
console.info('Y-coordinate bias: ' + data.biasY);
console.info('Z-coordinate bias: ' + data.biasZ);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_GRAVITY)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY)
-on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<GravityResponse>,options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<GravityResponse>,options?: Options): void
监听重力传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -129,23 +132,23 @@ on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<GravityRe
- 示例:
```
- sensor.on(type:SensorType.SENSOR_TYPE_ID_GRAVITY,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info('X-coordinate component: ' + data.x);
+ console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_GYROSCOPE)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE)
-on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<GyroscopeResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<GyroscopeResponse>, options?: Options): void
监听陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -158,23 +161,23 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<Gyrosco
- 示例:
```
- sensor.on(type:SensorType.SENSOR_TYPE_ID_GUROSCOPE,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info('X-coordinate component: ' + data.x);
+ console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
-on(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallback<GyroscopeUncalibratedResponse>, options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallback<GyroscopeUncalibratedResponse>, options?: Options): void
监听未校准陀螺仪传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -187,26 +190,26 @@ on(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallback&
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info('X-coordinate component: ' + data.x);
+ console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- console.info('X-coordinate bias: ' + data.biasX);
+ console.info('X-coordinate bias: ' + data.biasX);
console.info('Y-coordinate bias: ' + data.biasY);
console.info('Z-coordinate bias: ' + data.biasZ);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION)
-on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback<SignificantMotionResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback<SignificantMotionResponse>, options?: Options): void
监听大幅动作传感器数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -219,21 +222,21 @@ on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: AsyncCallback&l
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Scalar data: ' + data.scalar);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
-on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback<PedometerDetectResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback<PedometerDetectResponse>, options?: Options): void
监听计步检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -246,21 +249,21 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: AsyncCallback&
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,function(error,data){
if (error) {
- console.error(""Subscription failed. Error code: " + error.code + "; message: " + error.message);
+ console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Scalar data: ' + data.scalar);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_PEDOMETER)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER)
-on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<PedometerResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<PedometerResponse>, options?: Options): void
监听计步传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -273,21 +276,21 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<Pedomet
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Steps: ' + data.steps);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE)
-on(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback<AmbientTemperatureResponse>, options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback<AmbientTemperatureResponse>, options?: Options): void
监听环境温度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -300,21 +303,21 @@ on(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback<
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Temperature: ' + data.temperature);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD)
-on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<MagneticFieldResponse>,options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<MagneticFieldResponse>,options?: Options): void
监听磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -327,7 +330,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<Ma
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -335,15 +338,15 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<Ma
console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED)
-on(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCallback<MagneticFieldUncalibratedResponse>, options: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCallback<MagneticFieldUncalibratedResponse>, options: Options): void
监听未校准磁场传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -356,26 +359,26 @@ on(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCall
- 示例:
```
- ensor.on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info('X-coordinate component: ' + data.x);
- console.info('Y-coordinate component: ' + data.y);
- console.info('Z-coordinate component: ' + data.z);
- console.info('X-coordinate bias: ' + data.biasX);
+ console.info('X-coordinate component: ' + data.x);
+ console.info('Y-coordinate component: ' + data.y);
+ console.info('Z-coordinate component: ' + data.z);
+ console.info('X-coordinate bias: ' + data.biasX);
console.info('Y-coordinate bias: ' + data.biasY);
console.info('Z-coordinate bias: ' + data.biasZ);
- }
- {interval: 10000000} //设置数据的上报频率。
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_PROXIMITY)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY)
-on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<ProximityResponse>,options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<ProximityResponse>,options?: Options): void
监听接近光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -388,21 +391,21 @@ on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<Proximi
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Distance: ' + data.distance);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_HUMIDITY)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY)
-on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<HumidityResponse>,options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<HumidityResponse>,options?: Options): void
监听湿度传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -415,21 +418,21 @@ on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<Humidity
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Humidity: ' + data.humidity);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_BAROMETER)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER)
-on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<BarometerResponse>,options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<BarometerResponse>,options?: Options): void
监听气压计传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -442,21 +445,21 @@ on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<Baromet
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_BAROMETER,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Atmospheric pressure: ' + data.pressure);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_HALL)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL)
-on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResponse>, options?: Options): void
监听霍尔传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -469,21 +472,21 @@ on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResponse
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_HALL,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Status: ' + data.status);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT)
-on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<LightResponse>, options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<LightResponse>, options?: Options): void
监听环境光传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -496,21 +499,21 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<Lig
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info(''Illumination: ' + data.intensity);
- }
- {interval: 10000000}
+ console.info(' Illumination: ' + data.intensity);
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_ORIENTATION)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION)
-on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<OrientationResponse>, options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<OrientationResponse>, options?: Options): void
监听方向传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -523,7 +526,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<Orien
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -531,15 +534,15 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<Orien
console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR)
-on(type:SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback<RotationVectorResponse>,options?: Options): void
+on(type:sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback<RotationVectorResponse>,options?: Options): void
监听旋转矢量传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -552,7 +555,7 @@ on(type:SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback<Rota
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -560,15 +563,15 @@ on(type:SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback:AsyncCallback<Rota
console.info('X-coordinate component: ' + data.x);
console.info('Y-coordinate component: ' + data.y);
console.info('Z-coordinate component: ' + data.z);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.on(SensorType.SENSOR_TYPE_ID_WEAR_DETECTION)
+## sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION)
-on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<WearDetectionResponse>,options?: Options): void
+on(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<WearDetectionResponse>,options?: Options): void
监听佩戴检测传感器的数据变化。如果多次调用该接口,仅最后一次调用生效。
@@ -581,21 +584,21 @@ on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<We
- 示例:
```
- sensor.on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(error,data){
+ sensor.on(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
console.info('Wear status: ' + data.value);
- }
- {interval: 10000000}
+ },
+ {interval: 10000000}
);
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_ACCELEROMETER)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER)
-once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<AccelerometerResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<AccelerometerResponse>): void
监听加速度传感器的数据变化一次。
@@ -607,7 +610,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<A
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER,function(error,data){
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -620,9 +623,9 @@ once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: AsyncCallback<A
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION)
-once(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback<LinearAccelerometerResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback<LinearAccelerometerResponse>): void
监听线性加速度传感器数据变化一次。
@@ -634,7 +637,7 @@ once(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback&l
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -647,9 +650,9 @@ once(type:SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:AsyncCallback&l
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED)
-once(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallback<AccelerometerUncalibratedResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCallback<AccelerometerUncalibratedResponse>): void
监听未校准加速度传感器的数据变化一次。
@@ -661,7 +664,7 @@ once(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCal
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -677,9 +680,9 @@ once(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback:AsyncCal
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_GRAVITY)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY)
-once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<GravityResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<GravityResponse>): void
监听重力传感器的数据变化一次。
@@ -691,7 +694,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<Gravity
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_GRAVITY, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -704,9 +707,9 @@ once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: AsyncCallback<Gravity
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_GYROSCOPE)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE)
-once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<GyroscopeResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<GyroscopeResponse>): void
监听陀螺仪传感器的数据变化一次。
@@ -718,7 +721,7 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<Gyros
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -731,9 +734,9 @@ once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: AsyncCallback<Gyros
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED)
-once(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallback<GyroscopeUncalibratedResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallback<GyroscopeUncalibratedResponse>): void
监听未校准陀螺仪传感器的数据变化一次。
@@ -745,7 +748,7 @@ once(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallbac
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -761,9 +764,9 @@ once(type:SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:AsyncCallbac
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION)
-once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCallback<SignificantMotionResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCallback<SignificantMotionResponse>): void
监听有效运动传感器的数据变化一次。
@@ -775,7 +778,7 @@ once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCallback&l
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -786,9 +789,9 @@ once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION,callback:AsyncCallback&l
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION)
-once(type:SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback<PedometerDetectResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback<PedometerDetectResponse>): void
监听计步检测传感器数据变化一次。
@@ -800,7 +803,7 @@ once(type:SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback&l
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -811,9 +814,9 @@ once(type:SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION,callback:AsyncCallback&l
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_PEDOMETER)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER)
-once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<PedometerResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<PedometerResponse>): void
监听计步器传感器数据变化一次。
@@ -825,7 +828,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<Pedom
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_PEDOMETER, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -836,9 +839,9 @@ once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: AsyncCallback<Pedom
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE)
-once(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback<AmbientTemperatureResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback<AmbientTemperatureResponse>): void
监听环境温度传感器数据变化一次。
@@ -850,7 +853,7 @@ once(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback&l
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -861,9 +864,9 @@ once(type:SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:AsyncCallback&l
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD)
-once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<MagneticFieldResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<MagneticFieldResponse>): void
监听磁场传感器数据变化一次。
@@ -875,7 +878,7 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -888,9 +891,9 @@ once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: AsyncCallback<
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED)
-once(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCallback<MagneticFieldUncalibratedResponse>): void
+once(type:sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCallback<MagneticFieldUncalibratedResponse>): void
监听未校准磁场传感器数据变化一次。
@@ -902,7 +905,7 @@ once(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCa
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -918,9 +921,9 @@ once(type:SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback:AsyncCa
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_PROXIMITY)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY)
-once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<ProximityResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<ProximityResponse>): void
监听接近光传感器数据变化一次。
@@ -932,7 +935,7 @@ once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<Proxi
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_PROXIMITY, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_PROXIMITY, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -943,9 +946,9 @@ once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: AsyncCallback<Proxi
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_HUMIDITY)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY)
-once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<HumidityResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<HumidityResponse>): void
监听湿度传感器数据变化一次。
@@ -957,7 +960,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<Humidi
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_HUMIDITY, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HUMIDITY, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -968,9 +971,9 @@ once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: AsyncCallback<Humidi
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_BAROMETER)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER)
-once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<BarometerResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<BarometerResponse>): void
监听气压计传感器数据变化一次。
@@ -982,7 +985,7 @@ once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<Barom
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_BAROMETER, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -993,9 +996,9 @@ once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: AsyncCallback<Barom
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_HALL)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL)
-once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResponse>): void
监听霍尔传感器数据变化一次。
@@ -1007,7 +1010,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResp
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_HALL, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HALL, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -1018,9 +1021,9 @@ once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: AsyncCallback<HallResp
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT)
-once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<LightResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<LightResponse>): void
监听环境光传感器数据变化一次。
@@ -1032,20 +1035,20 @@ once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: AsyncCallback<L
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
}
- console.info(''Illumination: ' + data.intensity);
+ console.info(' Illumination: ' + data.intensity);
}
);
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_ORIENTATION)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION)
-once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<OrientationResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<OrientationResponse>): void
监听方向传感器数据变化一次。
@@ -1057,7 +1060,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<Ori
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_ORIENTATION, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -1070,9 +1073,9 @@ once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: AsyncCallback<Ori
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR)
-once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback<RotationVectorResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback<RotationVectorResponse>): void
监听旋转矢量传感器数据变化一次。
@@ -1084,7 +1087,7 @@ once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback<
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -1097,9 +1100,9 @@ once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: AsyncCallback<
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_HEART_RATE)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE)
-once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback<HeartRateResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback<HeartRateResponse>): void
监听心率传感器数据变化一次。
@@ -1111,7 +1114,7 @@ once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback<Hear
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_HEART_RATE, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_HEART_RATE, function(error, data) {
if (error) {
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
@@ -1122,9 +1125,9 @@ once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: AsyncCallback<Hear
```
-## sensor.once(SensorType.SENSOR_TYPE_ID_WEAR_DETECTION)
+## sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION)
-once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<WearDetectionResponse>): void
+once(type: sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<WearDetectionResponse>): void
监听佩戴检测传感器数据变化一次。
@@ -1136,7 +1139,7 @@ once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: AsyncCallback<
- 示例:
```
- sensor.once(type:SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(error, data) {
+ sensor.once(sensor.SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, function(error, data) {
if (error) {
console.error("Failed to register data, error code is" + error.code + ", message: " + error.message);
return;
@@ -1161,7 +1164,7 @@ off(type: SensorType, callback?: AsyncCallback<void>): void
- 示例:
```
- sensor.off(type:SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(error) {
+ sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, function(error) {
if (error) {
console.error("Failed to unsubscribe from acceleration sensor data. Error code: " + error.code + "; message: " + error.message);
return;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-stack.md b/zh-cn/application-dev/reference/apis/js-apis-stack.md
new file mode 100644
index 0000000000000000000000000000000000000000..a9250af729524f7f1c2277e1dbb91b27ac081e83
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-stack.md
@@ -0,0 +1,222 @@
+# 线性容器Stack
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {Stack} from '@ohos.util.Stack'
+```
+
+
+## 权限
+
+无
+
+
+## Stack
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | Stack的元素个数 |
+
+
+### constructor
+
+constructor();
+
+Stack的构造函数。
+
+
+- 示例:
+ ```
+ let stack = new Stack();
+ ```
+
+
+### push
+
+push(item: T): T;
+
+在栈顶插入元素,并返回该元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | item | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回被添加进去的元素 |
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push("a");
+ stack.push(1);
+ let b = [1, 2, 3];
+ stack.push(b);
+ let c = {name : "lala", age : "13"};
+ stack.push(false);
+ ```
+
+### pop
+
+pop(): T;
+
+删除栈顶元素并返回该删除元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(2);
+ stack.push(4);
+ stack.pop();
+ ```
+
+### peek
+
+peek(): T;
+
+获取并返回栈顶元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回栈顶元素 |
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(2);
+ stack.peek();
+ ```
+### locate
+
+locate(element: T): number;
+
+返回指定元素第一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 找到就返回下标值,查找失败返回-1 |
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(2);
+ stack.locate(2);
+ ```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, stack?: Stack<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历Stack实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素。 |
+ | index | number | 否 | 当前遍历到的下标值。 |
+ | stack | Stack<T> | 否 | 当前调用forEach方法的实例对象。 |
+
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(4);
+ stack.forEach((value, index) => {
+ console.log(value, index);
+ });
+ ```
+### isEmpty
+isEmpty(): boolean;
+
+判断该栈是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(4);
+ stack.isEmpty();
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+
+- 示例:
+ ```
+ let stack = new Stack();
+ stack.push(2);
+ stack.push(4);
+ stack.push(5);
+ stack.push(4);
+
+ // 使用方法一:
+ for (let item of stack) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = stack[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-treemap.md b/zh-cn/application-dev/reference/apis/js-apis-treemap.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5c7abe34f92fd7d6de77c0abbf36ae4caa853a8
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-treemap.md
@@ -0,0 +1,476 @@
+# 非线性容器TreeMap
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {TreeMap} from '@ohos.util.TreeMap'
+```
+
+
+## 权限
+
+无
+
+## TreeMap
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | TreeMap的元素个数 |
+
+
+### constructor
+
+constructor(comparator?:(firstValue: K, secondValue: K) => boolean);
+
+TreeMap的构造函数。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | comparator | function | 否 | 用户自定义的比较函数 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该容器是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const treeMap = new TreeMap();
+ treeMap.isEmpty();
+ ```
+
+
+### hasKey
+
+hasKey(key: K): boolean;
+
+判断此容器中是否含有该指定key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### hasValue
+
+hasValue(value: V): boolean;
+
+判断此容器中是否含有该指定value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.hasValue(123);
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.hasValue(123);
+ ```
+
+
+### get
+
+get(key: K): V;
+
+获取指定key所对应的value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 查找的指定key |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回key映射的value值 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ treeMap.get("sdfs");
+ ```
+
+
+### getFirstKey
+
+getFirstKey(): K;
+
+获取容器中排序第一的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | K | 返回排序第一的数据 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let result = treeMap.getFirstKey();
+ ```
+
+
+### getLastKey
+
+getLastKey(): K;
+
+获取容器中排序最后的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | K | 返回排序最后的数据 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let result = treeMap.getLastKey();
+ ```
+
+
+### setAll
+
+setAll(map: TreeMap): void;
+
+将一个treemap中的所有元素组添加到另一个treemap中。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | map | TreeMap | 是 | 被添加元素的treemap |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let map = new TreeMap();
+ treeMap.setAll(map);
+ ```
+
+
+### set
+set(key: K, value: V): Object;
+
+向treemap中添加一组数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 添加成员数据的键名 |
+ | value | V | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Object | 返回添加后的hashmap |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ ```
+
+
+### remove
+
+remove(key: K): V;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 依据key指定删除的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | V | 返回删除元素的值 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ treeMap.remove("sdfs");
+ ```
+
+
+### getLowerByKey
+
+getLowerByKey(key: K): K;
+
+获取容器中比传入key排序靠前一位的key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 对比的key值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | K | 返回排序中key前一位的数据 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ treeMap.set("zdfgsd", 356);
+ let result = treeMap.getLowerByKey("sdfs");
+ ```
+
+
+### getHigherByKey
+
+getHigherByKey(key: K): K;
+
+获取容器中比传入key排序靠后一位的key。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 对比的key值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | K | 返回排序中key后一位的数据 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ treeMap.set("zdfgsd", 356);
+ let result = treeMap.getHigherByKey("sdfs");
+ ```
+
+
+### replace
+replace(key: K, value: V): boolean;
+
+对TreeMap中一组数据进行更新(替换)。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | K | 是 | 依据key指定替换的元素 |
+ | value | V | 是 | 添加成员数据的值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否成功对已有数据进行替换 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("sdfs", 123);
+ treeMap.replace("sdfs", 357);
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除TreeMap中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ treeMap.clear();
+ ```
+
+
+### keys
+
+keys(): IterableIterator<K>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<K> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let iter = treeMap.keys();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### values
+
+values(): IterableIterator<V>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<V> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let iter = treeMap.values();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: V, key?: K, treeMap?: TreeMap) => void, thisArg?: Object): void;
+
+通过回调函数来遍历实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | V | 是 | 当前遍历到的元素键值对的值 |
+ | key | K | 是 | 当前遍历到的元素键值对的键 |
+ | treeMap | TreeMap | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("sdfs", 123);
+ treeMap.set("dfsghsf", 357);
+ treeMap.forEach((value, key) => {
+ console.log(value, key);
+ });
+ ```
+
+
+### entries
+
+entries(): IterableIterator<[K, V]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+ let iter = treeMap.entries();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<[K, V]>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[K, V]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeMap = new TreeMap();
+ treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123);
+ treeMap.set("sdfs", 356);
+
+ // 使用方法一:
+ for (let item of treeMap) {
+ console.log("key: " + item[0]);
+ console.log("value: " + item[1]);
+ }
+
+ // 使用方法二:
+ let iter = treeMap[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-treeset.md b/zh-cn/application-dev/reference/apis/js-apis-treeset.md
new file mode 100644
index 0000000000000000000000000000000000000000..30f1a22033dc77341aa214bcb1d835055c8922cf
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-treeset.md
@@ -0,0 +1,393 @@
+# 非线性容器TreeSet
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {TreeSet} from '@ohos.util.TreeSet'
+```
+
+
+## 权限
+
+无
+
+## TreeSet
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | TreeSet的元素个数 |
+
+
+### constructor
+
+constructor(comparator?:(firstValue: T, secondValue: T) => boolean);
+
+TreeSet的构造函数。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | comparator | function | 否 | 用户自定义的比较函数 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ ```
+
+
+### isEmpty
+
+isEmpty(): boolean;
+
+判断该容器是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ const treeSet = new TreeSet();
+ treeSet.isEmpty();
+ ```
+
+
+### has
+
+has(value: T): boolean;
+
+判断此容器中是否含有该指定value。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.has(123);
+ treeSet.add(123);
+ treeSet.has(123);
+ ```
+
+
+### getFirstValue
+
+getFirstValue(): T;
+
+获取容器中排序第一的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回排序第一的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let result = treeSet.getFirstValue();
+ ```
+
+
+### getLastValue
+
+getLastValue(): T;
+
+获取容器中排序最后的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回排序最后的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let result = treeSet.getLastValue();
+ ```
+
+
+### add
+add(value: T): boolean;
+
+向TreeSet中添加一组数据。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 添加的成员数据 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否成功添加新数据至容器 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+
+### remove
+
+remove(key: T): boolean;
+
+删除指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | T | 是 | 指定的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 判断是否成功删除元素 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ treeSet.remove("sdfs");
+ ```
+
+
+### getLowerValue
+
+getLowerValue(key: T): T;
+
+获取容器中比传入元素排序靠前一位的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | T | 是 | 对比的元素值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回排序中对比元素前一位的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ treeSet.add("zdfgsd");
+ let result = treeSet.getLowerValue("sdfs");
+ ```
+
+
+### getHigherValue
+
+getHigherValue(key: T): T;
+
+获取容器中比传入元素排序靠后一位的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | key | T | 是 | 对比的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回排序中传入元素后一位的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ treeSet.add("zdfgsd");
+ let result = treeSet.getHigherValue("sdfs");
+ ```
+
+
+### popFirst
+
+popFirst(): T;
+
+删除容器中排序最前的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let result = treeSet.popFirst();
+ ```
+
+
+### popLast
+
+popLast(): T;
+
+删除容器中排序最后的数据。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的数据 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let result = treeSet.popLast();
+ ```
+
+
+### clear
+
+clear(): void;
+
+清除容器中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ treeSet.clear();
+ ```
+
+
+### values
+
+values(): IterableIterator<T>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let iter = treeSet.values();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### forEach
+
+forEach(callbackfn: (value: T, key?: T, treeSet?: TreeSet<T>) => void, thisArg?: Object): void;
+
+通过回调函数来遍历实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | key | T | 否 | 当前遍历到的元素(和value相同). |
+ | treeSet | TreeSet<T> | 否 | 当前调用forEach方法的实例对象 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("sdfs");
+ treeSet.add("dfsghsf");
+ treeSet.forEach((value, key) => {
+ console.log(value, key)
+ });
+ ```
+
+
+### entries
+
+entries(): IterableIterator<[T, T]>;
+
+返回包含此映射中包含的键的新迭代器对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<[T, T]> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+ let iter = treeSet.entries();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp[0]);
+ console.log(temp[1]);
+ temp = iter.next().value;
+ }
+ ```
+
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器 |
+
+- 示例:
+ ```
+ let treeSet = new TreeSet();
+ treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ treeSet.add("sdfs");
+
+ // 使用方法一:
+ for (let item of treeSet) {
+ console.log("value: " + item);
+ }
+
+ // 使用方法二:
+ let iter = treeSet[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-uri.md b/zh-cn/application-dev/reference/apis/js-apis-uri.md
index 3d557c30957aba3b1b92df02452bb8a90a087847..8979b69c8ae98a5ede706c80c876528be29337d6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-uri.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-uri.md
@@ -10,12 +10,6 @@
import uri from '@ohos.uri'
```
-
-## 权限
-
-无
-
-
## URI
@@ -64,7 +58,7 @@ toString(): string
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | string | 用于返回网址的字符串序列化。 |
+ | string | 返回网址的字符串序列化。 |
- 示例:
```
@@ -87,7 +81,7 @@ equals(other: URI): boolean
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | boolean | 用于测试此URI是否与其他URI对象相等。 |
+ | boolean | 返回true表示相等,否则返回false。 |
- 示例:
```
@@ -96,15 +90,16 @@ equals(other: URI): boolean
uriInstance.equals(uriInstance1);
```
-
### checkIsAbsolute
-判断此URI是否为绝对URI。
+checkIsAbsolute(): boolean
+
+判断此URI是否为绝对URI(是否定义了scheme组件)。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | boolean | 用于说明此URI是否为绝对URI(是否定义了scheme组件)。 |
+ | boolean | 返回true表示该URI是否为绝对URI。 |
- 示例:
```
@@ -122,7 +117,7 @@ normalize(): URI
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | URI | 用于规范化此URI的路径,并返回一个path被规范化后的URI对象。 |
+ | URI | 返回一个path被规范化后的URI对象。 |
- 示例:
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md
index bbe12540d1a55d2357a60ab06ac3fe49d04d84ce..e8b003482705ae144781b70d18953e481f045f7a 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-url.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-url.md
@@ -11,11 +11,6 @@ import Url from '@ohos.url'
```
-## 权限
-
-无
-
-
## URLSearchParams
diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md
index 71707c4098ba3429ec091d68d343c151453bdf49..0a49bd1313bfb8dc938163bf9f78311415e1f8b2 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-util.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-util.md
@@ -15,11 +15,6 @@ import util from '@ohos.util';
```
-## 权限
-
-无
-
-
## util.printf
printf(format: string, ...args: Object[]): string
@@ -296,7 +291,7 @@ RationalNumber的构造函数。
- 示例:
```
- var rationalNumber = new util.RationalNumber(1,2);
+ var rationalNumber = new util.RationalNumber(1,2);
```
@@ -551,7 +546,7 @@ constructor(capacity?:number)
- 示例:
```
- var lrubuffer= new util.LruBuffer();
+ var lrubuffer= new util.LruBuffer();
```
@@ -661,7 +656,7 @@ getMissCount():number
```
var pro = new util.LruBuffer();
pro.put(2,10);
- pro.get(2)
+ pro.get(2);
var result = pro.getMissCount();
```
@@ -896,7 +891,7 @@ afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void
}
}
}
- ChildLruBuffer.getInstance().afterRemoval(false,10,30,null);
+ ChildLruBuffer.getInstance().afterRemoval(false,10,30,null);
```
@@ -1115,7 +1110,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
var tempMiDF = new Temperature(35);
var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.intersect(tempMiDF, tempMidS);
+ var result = range.intersect(tempMiDF, tempMidS);
```
@@ -1135,7 +1130,7 @@ getUpper():ScopeType
var tempLower = new Temperature(30);
var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.getUpper();
+ var result = range.getUpper();
```
@@ -1155,7 +1150,7 @@ getLower():ScopeType
var tempLower = new Temperature(30);
var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.getLower();
+ var result = range.getLower();
```
@@ -1183,7 +1178,7 @@ expand(lowerObj:ScopeType,upperObj:ScopeType):Scope
var tempMiDF = new Temperature(35);
var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.expand(tempMiDF, tempMidS);
+ var result = range.expand(tempMiDF, tempMidS);
```
@@ -1211,7 +1206,7 @@ expand(range:Scope):Scope
var tempMidS = new Temperature(39);
var range = new util.Scope(tempLower, tempUpper);
var rangeFir = new util.Scope(tempMiDF, tempMidS);
- var result = range.expand(rangeFir);
+ var result = range.expand(rangeFir);
```
@@ -1237,7 +1232,7 @@ expand(value:ScopeType):Scope
var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.expand(tempMiDF);
+ var result = range.expand(tempMiDF);
```
@@ -1263,7 +1258,7 @@ contains(value:ScopeType):boolean
var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper);
- range.contains(tempMiDF);
+ range.contains(tempMiDF);
```
@@ -1291,7 +1286,7 @@ contains(range:Scope):boolean
var tempLess = new Temperature(20);
var tempMore = new Temperature(45);
var rangeSec = new util.Scope(tempLess, tempMore);
- var result = range.contains(rangeSec);
+ var result = range.contains(rangeSec);
```
@@ -1309,7 +1304,7 @@ clamp(value:ScopeType):ScopeType
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value |
+ | [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 |
- 示例:
```
@@ -1317,7 +1312,7 @@ clamp(value:ScopeType):ScopeType
var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35);
var range = new util.Scope(tempLower, tempUpper);
- var result = range.clamp(tempMiDF);
+ var result = range.clamp(tempMiDF);
```
@@ -1332,7 +1327,7 @@ Base64的构造函数。
- 示例:
```
- var base64 = new util.Base64();
+ var base64 = new util.Base64();
```
@@ -1429,12 +1424,11 @@ encode(src:Uint8Array):Promise<Uint8Array>
var that = new util.Base64();
var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]);
- await that.encode(array).then(val=>{
+ that.encode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i])
}
})
- done();
```
@@ -1458,10 +1452,9 @@ encodeToString(src:Uint8Array):Promise<string>
```
var that = new util.Base64();
var array = new Uint8Array([115,49,51]);
- await that.encodeToString(array).then(val=>{
+ that.encodeToString(array).then(val=>{
expect(val).assertEqual('czEz')
})
- done();
```
@@ -1486,12 +1479,11 @@ decode(src:Uint8Array | string):Promise<Uint8Array>
var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]);
- await that.decode(array).then(val=>{
+ that.decode(array).then(val=>{
for (var i = 0; i < rarray.length; i++) {
expect(val[i]).assertEqual(rarray[i])
}
})
- done();
```
@@ -1588,7 +1580,7 @@ isArgumentsObject(value: Object):boolean
isArrayBuffer(value: Object):boolean
-检查输入的value是否是ArrayBuffer对象类型。
+检查输入的value是否是ArrayBuffer类型。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-vector.md b/zh-cn/application-dev/reference/apis/js-apis-vector.md
new file mode 100644
index 0000000000000000000000000000000000000000..4453db94cb7b85427b75b61025df0e41fa752b72
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-vector.md
@@ -0,0 +1,684 @@
+# 线性容器Vector
+
+>  **说明:**
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+
+## 导入模块
+
+```
+import {Vector} from '@ohos.util.Vector'
+```
+
+
+## 权限
+
+无
+
+
+## Vector
+
+
+### 属性
+
+| 名称 | 参数类型 | 可读 | 可写 | 说明 |
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | 是 | 否 | Vector的元素个数 |
+
+
+### constructor
+
+constructor();
+
+Vector的构造函数。
+
+- 示例:
+ ```
+ let vector = new Vector();
+ ```
+
+
+### add
+
+add(element: T): boolean;
+
+在Vector中尾部插入元素
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 添加进去的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 插入成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add("a");
+ vector.add(1);
+ let b = [1, 2, 3];
+ vector.add(b);
+ let c = {name : "lala", age : "13"};
+ vector.add(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void;
+
+在长度范围内任意插入指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 被插入的元素 |
+ | index | number | 是 | 被插入的位置索引 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.insert("A", 0);
+ vector.insert(0, 1);
+ vector.insert(true, 2);
+ ```
+
+### has
+
+has(element: T): boolean;
+
+判断此Vector中是否含有该指定元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 是否包含指定元素 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ vector.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ vector.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+ ```
+
+### getIndexOf
+
+getIndexOf(element: T): number;
+
+返回指定元素第一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定的元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素第一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(2);
+ vector.add(1);
+ vector.add(2);
+ vector.add(4);
+ vector.getIndexOf(2);
+ ```
+### getLastIndexOf
+
+getLastIndexOf(element: T): number;
+
+返回指定元素最后一次出现时的下标值,查找失败返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回指定元素最后一次出现时的下标值,查找失败返回-1 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(2);
+ vector.add(1);
+ vector.add(2);
+ vector.add(4);
+ vector.getLastIndexOf(2);
+ ```
+### removeByIndex
+
+removeByIndex(index: number): T;
+
+根据元素的下标值查找元素,返回元素后将其删除。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | index | number | 是 | 指定元素的下标值 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回删除的元素 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(2);
+ vector.add(4);
+ vector.removeByIndex(2);
+ ```
+
+### remove
+
+remove(element: T): boolean;
+
+删除查找到的第一个指定的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 指定元素 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 删除成功返回true,失败返回false |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.remove(2);
+ ```
+### removeByRange
+removeByRange(fromIndex: number, toIndex: number): void;
+
+从一段范围内删除元素,包括起始值但不包括终止值。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | fromIndex | number | 是 | 起始下标 |
+ | toIndex | number | 是 | 终止下标 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.removeByRange(2,4);
+ vector.removeByRange(4,3);
+ vector.removeByRange(2,6);
+ ```
+
+### replaceAllElements
+replaceAllElements(callbackfn: (value: T, index?: number, vector?: Vector<T>) => T,
+thisArg?: Object): void;
+
+用户操作Vector中的元素,用操作后的元素替换原元素并返回操作后的元素。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素 |
+ | index | number | 否 | 当前遍历到的下标值 |
+ | vector | Vector<T> | 否 | 当前调用replaceAllElements方法的实例对象 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.replaceAllElements((value, index) => {
+ return value = 2 * value;
+ });
+ vector.replaceAllElements((value, index) => {
+ return value = value - 2;
+ });
+ ```
+### forEach
+forEach(callbackfn: (value: T, index?: number, vector?: Vector<T>) => void,
+thisArg?: Object): void;
+
+通过回调函数来遍历Vector实例对象上的元素以及元素对应的下标。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | callbackfn | function | 是 | 回调函数。 |
+ | thisArg | Object | 否 | callbackfn被调用时用作this值 |
+
+- callbackfn的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | value | T | 是 | 当前遍历到的元素。 |
+ | index | number | 否 | 当前遍历到的下标值。 |
+ | vector | Vector<T> | 否 | 当前调用forEach方法的实例对象。 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.forEach((value, index) => {
+ console.log(value, index)
+ });
+
+ ```
+### sort
+sort(comparator?: (firstValue: T, secondValue: T) => number): void;
+
+对Vector中的元素进行一个排序操作。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | comparator | function | 否 | 回调函数。 |
+
+- comparator的参数说明
+
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | firstValue | T | 是 | 前一项元素 |
+ | secondValue | T | 是 | 后一项元素 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.sort(a, (b => a - b));
+ vector.sort(a, (b => b - a));
+ vector.sort();
+ ```
+### subVector
+subVector(fromIndex: number, toIndex: number): Vector<T>;
+
+根据下标截取Vector中的一段元素,并返回这一段vector实例,包括起始值但不包括终止值。
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | fromIndex | number | 是 | 起始下标 |
+ | toIndex | number | 是 | 终止下标 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Vector<T> | 返回Vector对象实例 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.subVector(2,4);
+ vector.subVector(4,3);
+ vector.subVector(2,6);
+
+ ```
+
+### clear
+clear(): void;
+
+清除Vector中的所有元素,并把length置为0。
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.clear();
+ ```
+### clone
+clone(): Vector<T>;
+
+克隆一个与Vector一模一样的实例,并返回克隆后的实例,修改克隆后的实例并不会影响原实例。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Vector<T> | 返回Vector对象实例 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.clone();
+ ```
+### getCapacity
+getCapacity(): number;
+
+获取当前实例的容量大小。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回Vector的容量大小 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.getCapacity();
+ ```
+### convertToArray
+convertToArray(): Array<T>;
+
+把当前Vector实例转换成数组,并返回转换后的数组。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | Array<T> | 返回数组类型 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.convertToArray();
+ ```
+### isEmpty
+isEmpty(): boolean;
+
+判断该Vector是否为空。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | boolean | 为空返回true, 不为空返回false |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.isEmpty();
+ ```
+### increaseCapacityTo
+increaseCapacityTo(newCapacity: number): void;
+
+如果传入的新容量大于或等于Vector中的元素个数,将容量变更为新容量。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | newCapacity | number | 是 | 新容量 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.increaseCapacityTo(2);
+ vector.increaseCapacityTo(8);
+ ```
+### trimToCurrentLength
+trimToCurrentLength(): void;
+
+把容量限制为当前的length大小。
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.trimToCurrentLength(2);
+ ```
+### toString
+
+toString(): string;
+用","将Vector实例中的元素按顺序拼接成字符串。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | string | 返回字符串类型 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.toSting();
+ ```
+
+### copyToArray
+
+copyToArray(array: Array<T>): void;
+将Vector实例中的元素按照下标复制进array。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | array | Array<T> | 是 | 数组 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ let array = ["a", "b", "c", "d", "e", "f"];
+ vector.copyToArray(array);
+ ```
+### getFirstElement
+
+getFirstElement(): T;
+获取实例中的第一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.getFirstElement();
+ ```
+### getLastElement
+
+getLastElement(): T;
+获取Vector实例中的最后一个元素。
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | T | 返回T型 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.getLastElement();
+ ```
+### getLastIndexFrom
+
+getLastIndexFrom(element: T, index: number): number;
+
+从指定索引向后搜索, 返回该元素的下标索引,如果查找失败,则返回-1。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 要查找的元素 |
+ | index | number | 是 | 从指定索引开始搜索 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回该元素的下标 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.add("a");
+ vector.getLastIndexFrom(4,3);
+ ```
+### getIndexFrom
+
+getIndexFrom(element: T, index: number): number;
+
+从指定索引向前搜索, 返回该元素的下标索引,如果查找失败,则返回 -1
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | element | T | 是 | 要查找的元素 |
+ | index | number | 是 | 从指定索引开始搜索 |
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | number | 返回该元素的下标 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.add("a");
+ vector.getIndexFrom(4, 3);
+ ```
+### setLength
+setLength(newSize: number): void;
+设置Vector实例的元素个数。
+
+- 参数:
+ | 参数名 | 类型 | 必填 | 说明 |
+ | -------- | -------- | -------- | -------- |
+ | newSize | number | 是 | 设置的新长度 |
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+ vector.setLength(8);
+ vector.setLength(2);
+ ```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>;
+
+
+返回一个迭代器,迭代器的每一项都是一个 JavaScript 对象,并返回该对象。
+
+
+- 返回值:
+ | 类型 | 说明 |
+ | -------- | -------- |
+ | IterableIterator<T> | 返回一个迭代器。 |
+
+
+- 示例:
+ ```
+ let vector = new Vector();
+ vector.add(2);
+ vector.add(4);
+ vector.add(5);
+ vector.add(4);
+
+ // 使用方法一:
+ for (let item of vector) {
+ console.log(item);
+ }
+
+ // 使用方法二:
+ let iter = vector[Symbol.iterator]();
+ let temp = iter.next().value;
+ while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+ }
+ ```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md
index 9cfa6ff54f467089e50f0d2e26cab8a01e9e27b4..7e4d658d1a434da4af2e0b54d058bc7da917300d 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-vibrator.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-vibrator.md
@@ -7,16 +7,19 @@
## 导入模块
```
-import vibrate from '@ohos.vibrator';
+import vibrator from '@ohos.vibrator';
```
+## 系统能力
+
+SystemCapability.Sensors.MiscDevice
## 权限列表
ohos.permission.VIBRATE
-## vibrate.vibrate
+## vibrator.vibrate
vibrate(duration: number): Promise<void>
@@ -37,17 +40,15 @@ vibrate(duration: number): Promise<void>
- 示例:
```
- vibrator.vibrate(1000).then(error)=>{
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- console.log(“Promise returned to indicate a successful vibration.”);
- }
- }
+ vibrator.vibrate(1000).then(()=>{
+ console.log("Promise returned to indicate a successful vibration.");
+ }, (error)=>{
+ console.log("error.code"+error.code+"error.message"+error.message);
+ });
```
-## vibrate.vibrate
+## vibrator.vibrate
vibrate(duration: number, callback?: AsyncCallback<void>): void
@@ -62,16 +63,16 @@ vibrate(duration: number, callback?: AsyncCallback<void>): void
- 示例**:**
```
vibrator.vibrate(1000,function(error){
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- console.log(“Callback returned to indicate a successful vibration.”);
- }
+ if(error){
+ console.log("error.code"+error.code+"error.message"+error.message);
+ }else{
+ console.log("Callback returned to indicate a successful vibration.");
+ }
})
```
-## vibrate.vibrate
+## vibrator.vibrate
vibrate(effectId: EffectId): Promise<void>
@@ -89,17 +90,15 @@ vibrate(effectId: EffectId): Promise<void>
- 示例:
```
- vibrator.vibrate(effectId:EffectId).then(error)=>{
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- Console.log(“Promise returned to indicate a successful vibration.”);
- }
- }
+ vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(()=>{
+ console.log("Promise returned to indicate a successful vibration.");
+ }, (error)=>{
+ console.log("error.code"+error.code+"error.message"+error.message);
+ });
```
-## vibrate.vibrate
+## vibrator.vibrate
vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void
@@ -113,17 +112,17 @@ vibrate(effectId: EffectId, callback?: AsyncCallback<void>): void
- 示例:
```
- vibrator.vibrate(effectId:EffectId,function(error){
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- console.log(“Callback returned to indicate a successful vibration.”);
- }
+ vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER, function(error){
+ if(error){
+ console.log("error.code"+error.code+"error.message"+error.message);
+ }else{
+ console.log("Callback returned to indicate a successful vibration.");
+ }
})
```
-## vibrate.stop
+## vibrator.stop
stop(stopMode: VibratorStopMode): Promise<void>
@@ -141,17 +140,15 @@ stop(stopMode: VibratorStopMode): Promise<void>
- 示例:
```
- vibrator.stop(stopMode:VibratorStopMode).then((error)=>{
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- Console.log(“Promise returned to indicate successful.”);
- }
- })
+ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then(()=>{
+ console.log("Promise returned to indicate a successful vibration.");
+ }, (error)=>{
+ console.log("error.code"+error.code+"error.message"+error.message);
+ });
```
-## vibrate.stop
+## vibrator.stop
stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void;
@@ -165,12 +162,12 @@ stop(stopMode: VibratorStopMode, callback?: AsyncCallback<void>): void;
- 示例:
```
- vibrator.stop(stopMode:VibratorStopMode,function(error){
- if(error){
- console.log(“error.code”+error.code+“error.message”+error.message);
- }else{
- Console.log(“Callback returned to indicate successful.”);
- }
+ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, function(error){
+ if(error){
+ console.log("error.code"+error.code+"error.message"+error.message);
+ }else{
+ console.log("Callback returned to indicate successful.");
+ }
})
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md
index ff45b896576008a906846753b579d928b04cbaf1..7ceb3a6c4b5c0ed422b81e41d329679df0464c73 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-window.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-window.md
@@ -11,6 +11,11 @@ import window from '@ohos.window';
```
+## 系统能力
+SystemCapability.WindowManager.WindowManager.Core
+
+
+
## 权限列表
ohos.permission.SYSTEM_FLOAT_WINDOW
@@ -189,7 +194,7 @@ getAbilityWindowMode(callback: AsyncCallback<WindowMode>): void
```
window.getAbilityWindowMode((err, data) => {
if (err) {
- console.error(''Failed to obtain the window mode. Cause:' + JSON.stringify(err));
+ console.error('Failed to obtain the window mode. Cause:' + JSON.stringify(err));
return;
}
console.info('Window mode obtained. Data:' + JSON.stringify(data))
diff --git a/zh-cn/application-dev/reference/apis/js-apis-worker.md b/zh-cn/application-dev/reference/apis/js-apis-worker.md
index 32c60ad58e313e0bae553022f4e6a742903c9341..57eaaf62badf4a17f228717065573bc2d9be67e4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-worker.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-worker.md
@@ -11,11 +11,6 @@ import worker from '@ohos.worker';
```
-## 权限
-
-无
-
-
## 属性
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
@@ -51,7 +46,7 @@ worker构造函数。
| options | [WorkerOptions](#workeroptions) | 否 | worker构造的选项。 |
- 返回值:
- | 参数名 | 说明 |
+ | 类型 | 说明 |
| -------- | -------- |
| worker | 执行Worker构造函数生成的Worker对象,失败则返回undefined。 |
@@ -294,7 +289,7 @@ dispatchEvent(event: Event): boolean
| event | [Event](#event) | 是 | 需要分发的事件。 |
- 返回值:
- | 参数名 | 说明 |
+ | 类型 | 说明 |
| -------- | -------- |
| boolean | 分发的结果,false表示分发失败。 |
@@ -347,7 +342,7 @@ worker向宿主线程发送消息。
```
```
// worker.js
- import worker from "@ohos.worker";
+ import worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e){
parentPort.postMessage("receive data from main.js")
@@ -369,7 +364,7 @@ close(): void
```
```
// worker.js
- import worker from "@ohos.worker";
+ import worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
parentPort.close()
@@ -397,7 +392,7 @@ DedicatedWorkerGlobalScope的onmessage属性表示worker线程收到来自其宿
```
```
// worker.js
- import worker from "@ohos.worker";
+ import worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessage = function(e) {
console.log("receive main.js message")
@@ -424,7 +419,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收
```
```
// worker.js
- import worker from "@ohos.worker";
+ import worker from '@ohos.worker';
const parentPort = worker.parentPort;
parentPort.onmessageerror= function(e) {
console.log("worker.js onmessageerror")
@@ -466,7 +461,7 @@ DedicatedWorkerGlobalScope的onmessageerror属性表示当 Worker 对象接收
| evt | [Event](#event) | 是 | 回调的事件类。 |
- 返回值
- | 参数名 | 说明 |
+ | 类型 | 说明 |
| -------- | -------- |
| void \| Promise<void> | 无返回值或者以Promise形式返回。 |
@@ -533,7 +528,7 @@ WorkerGlobalScope的onerror属性表示worker在执行过程中发生异常被
```
```
// worker.js
- import worker from "@ohos.worker";
+ import worker from '@ohos.worker';
const parentPort = worker.parentPort
parentPort.onerror = function(e){
console.log("worker.js onerror")
diff --git a/zh-cn/application-dev/reference/apis/js-apis-xml.md b/zh-cn/application-dev/reference/apis/js-apis-xml.md
index fe319f9f62406f7282e42d1afa540525efb3555f..3765c3ff2c2b877bb4b7c16a2ff57b1669ff2933 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-xml.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-xml.md
@@ -11,11 +11,6 @@ import xml from '@ohos.xml';
```
-## 权限
-
-无
-
-
## XmlSerializer
@@ -28,7 +23,7 @@ XmlSerializer的构造函数。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | buffer | ArrayBuffer \| DataView | 是 | 用于接收写入xml信息的ArrayBuffer \| DataView内存。 |
+ | buffer | ArrayBuffer \| DataView | 是 | 用于接收写入xml信息的ArrayBuffer或DataView内存。 |
| encoding | string | 否 | 编码格式。 |
- 示例:
@@ -48,8 +43,8 @@ setAttributes(name: string, value: string):void
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | name | string | 是 | 属性的key值 |
- | value | string | 是 | 属性的value值 |
+ | name | string | 是 | 属性的key值。 |
+ | value | string | 是 | 属性的value值。 |
- 示例:
```
@@ -67,7 +62,7 @@ addEmptyElement(name: string): void
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | name | string | 是 | 该空元素的元素名 |
+ | name | string | 是 | 该空元素的元素名。 |
- 示例:
```
@@ -93,12 +88,12 @@ setDeclaration(): void
startElement(name: string): void
-XmlSerializer的构造函数。
+根据给定名称写入元素开始标记。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | name | string | 是 | 当前元素的元素名 |
+ | name | string | 是 | 当前元素的元素名。 |
- 示例:
```
@@ -113,7 +108,7 @@ XmlSerializer的构造函数。
endElement(): void
-设置结束元素方法。
+写入元素结束标记。
- 示例:
```
@@ -135,8 +130,8 @@ setNamespace(prefix: string, namespace: string): void
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | prefix | string | 是 | 当前元素及其子元素的前缀 |
- | namespace | string | 是 | 当前元素及其子元素的命名空间 |
+ | prefix | string | 是 | 当前元素及其子元素的前缀。 |
+ | namespace | string | 是 | 当前元素及其子元素的命名空间。 |
- 示例:
```
@@ -148,43 +143,43 @@ setNamespace(prefix: string, namespace: string): void
thatSer.endElement();// = >'\r\n';
```
-### setCommnet
+### setComment
-setCommnet(text: string): void
+setComment(text: string): void
写入comment属性。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | text | string | 是 | 当前元素的注释内容 |
+ | text | string | 是 | 当前元素的注释内容。 |
- 示例:
```
var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note");
- thatSer.setCommnet("Hi!");
+ thatSer.setComment("Hi!");
thatSer.endElement(); // => '\r\n \r\n';
```
-### setCData
+### setCDATA
-setCData(text: string): void
+setCDATA(text: string): void
-写入CData属性。
+写入CDATA属性。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | text | string | 是 | CDate属性的内容 |
+ | text | string | 是 | CDATA属性的内容。 |
- 示例:
```
var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer);
- thatSer.setCData('root SYSTEM') // => '';
+ thatSer.setCDATA('root SYSTEM') // => '';
```
@@ -197,7 +192,7 @@ setText(text: string): void
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | text | string | 是 | text属性的内容 |
+ | text | string | 是 | text属性的内容。 |
- 示例:
```
@@ -219,7 +214,7 @@ setDocType(text: string): void
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | text | string | 是 | DocType属性的内容 |
+ | text | string | 是 | DocType属性的内容。 |
- 示例:
```
@@ -241,8 +236,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | buffer | ArrayBuffer \| DataView | 是 | 含有xml文本信息的ArrayBuffer 或者DataView |
- | encoding | string | 否 | 编码格式(仅支持utf-8) |
+ | buffer | ArrayBuffer \| DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 |
+ | encoding | string | 否 | 编码格式(仅支持utf-8)。 |
- 示例:
```
@@ -325,12 +320,12 @@ xml解析选项。
getColumnNumber(): number
-获取当前行号,从1开始。
+获取当前列号,从1开始。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 返回当前行号。 |
+ | number | 返回当前列号。 |
### getDepth
@@ -349,12 +344,12 @@ getDepth(): number
getLineNumber(): number
-获取当前列号,从1开始。
+获取当前行号,从1开始。
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
- | number | 返回当前列号。 |
+ | number | 返回当前行号。 |
### getName
diff --git a/zh-cn/contribute/OpenHarmony-64bits-coding-guide.md b/zh-cn/contribute/OpenHarmony-64bits-coding-guide.md
index a9a6b2b27ecd7c5b357b520ad8646817b80eeb44..4b13d58fcaf4829611ed49195b4fcf618772ab7c 100755
--- a/zh-cn/contribute/OpenHarmony-64bits-coding-guide.md
+++ b/zh-cn/contribute/OpenHarmony-64bits-coding-guide.md
@@ -7,7 +7,7 @@
OpenHarmony的目标是面向全场景、全连接、全智能时代,基于开源的方式,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。具有“硬件互助,资源共享”、“一次开发,多端部署”、“统一OS,弹性部署”的技术特性。
OpenHarmony支持三种系统类型:
-1. 轻量系统(mini system),面向从MCU类处理器(例如Arm Cortex-M、RISC-V 32位)的轻量设备,硬件资源极其有限,支持的设备最小内存为128KiB;
+1. 轻量系统(mini system),面向MCU类处理器(例如Arm Cortex-M、RISC-V 32位)的轻量设备,硬件资源极其有限,支持的设备最小内存为128KiB;
2. 小型系统(small system),面向应用处理器(例如Arm Cortex-A 64位)的设备,支持的设备最小内存为1MiB
3. 标准系统(standard system),面向应用处理器(例如Arm Cortex-A 64位)的设备,支持的设备最小内存为128MiB
@@ -35,7 +35,7 @@ OpenHarmony支持三种系统类型:
| size_t | **4** | **8** | **8** | 4 | 8 |
| pointer | **4** | **8** | **8** | 4 | 8 |
-上表中只包含了部分基本类型,下表分别将ILP32和LP64的siziof和print`进行对比,展示了更全面的常量和类型对应的差异:
+上表中只包含了部分基本类型,下表分别将ILP32和LP64的sizeof和print`进行对比,展示了更全面的常量和类型对应的差异:
| Type | ILP32 sizeof | ILP32 print | LP64 sizeof | LP64 print | 备注 |
| ------------------ | ------------ | ----------- | ----------- | ---------- | ------ |
@@ -115,8 +115,8 @@ typedef struct tagFoo {
| uint16_t | 2 | 2 | %u | 代替unsigned short |
| int32_t | 4 | 4 | %d | 代替int |
| uint32_t | 4 | 4 | %u | 代替unsigned int |
-| int64_t | 8 | 8 | %PRId64 | 代替long long,宏实现代码兼容 |
-| uint64_t | 8 | 8 | %PRIu64 | 代替unsigned longlong,宏实现代码兼容 |
+| int64_t | 8 | 8 | %PRId64 | 代替long long、宏实现代码兼容 |
+| uint64_t | 8 | 8 | %PRIu64 | 代替unsigned long long、宏实现代码兼容 |
| float | 4 | 4 | %f | 单精度浮点数 |
| double | 8 | 8 | %lf | 双精度浮点数 |
| bool | 1 | 1 | %d | 布尔类型 |
@@ -170,7 +170,7 @@ long var;
#### 【规则】当需要采用整型变量来存储指针时,变量应该定义成uintptr_t以适应不同的位宽
-【说明】uintptr_t类型用于用于存储指针长度级别的数据,其长度在32位和64位可自动适应。
+【说明】uintptr_t类型用于用于存储指针长度的数据,其长度在32位和64位可自动适应。
【示例】
@@ -262,7 +262,7 @@ format ‘%p’ expects argument of type ‘void *’, but argument 2 has type
| 0x80000000LL | 8 | 8 | 增加LL后缀,小于uint32_t范围,长度固定 |
| 0x8000000000 | **NA或8** | **8** | 无后缀,超过uint32_t的范围,编译器默认为LL或无效,64位下固定为uint64_t类型 |
| 0x8000000000L | **NA或8** | **8** | 后缀为L,对超过uint32_t的范围常数,增加该参数没有意义,应当避免使用 |
-| 0x8000000000LL | 8 | 8 | 默认为LL,uint64_t类型 |
+| 0x8000000000LL | 8 | 8 | 后缀为LL,uint64_t类型 |
从上表中可看出,使用L或UL后缀的常量,其长度在32位和64位下发生变化,不利于代码的可移植性,因此禁止使用这个后缀。
@@ -533,7 +533,7 @@ q = (int32_t *) (int32_t)&i;
int32_t length = (int32_t)strlen(str); // 错误
```
-strlen返回size_t(它在LP64中是unsigned long),当赋值给一个int32_t时,截断是必然发生的。而通常,截断只会在str的长度大于2GB时才会发生,这种情况在程序中一般不会出现,容易出现问题。
+strlen返回size_t(它在LP64中是unsigned long),当赋值给一个int32_t时,截断是必然发生的。而通常,截断只会在str的长度大于2GB时才会发生,这种情况在程序中一般不会出现,容易忽略。
#### 【规则】在64位环境下使用大数组或大for循环索引时,索引类型应当与下标边界保持一致
diff --git a/zh-cn/contribute/OpenHarmony-hdf-coding-guide.md b/zh-cn/contribute/OpenHarmony-hdf-coding-guide.md
index 1c7ae8e8f2bf412c75499e91eb5d1eace88de77e..1521c5dab674669f3497d607275ac24a723aff52 100755
--- a/zh-cn/contribute/OpenHarmony-hdf-coding-guide.md
+++ b/zh-cn/contribute/OpenHarmony-hdf-coding-guide.md
@@ -16,7 +16,7 @@ HDF(Hardware Driver Foundation)驱动框架,为开发者提供驱动框架
#### 【规则】OpenHarmony的驱动程序,应当使用HDF框架提供的能力实现
-【说明】HDF驱动框架提供了驱动加载、驱动服务管理和驱动消息机制,同时还提供了操作系统抽象层(OSAL, Operating System Abstract Layer)和平台抽象层(PAL, Platform Abstract Layer)来保证驱动程序的跨系统跨平台部署的特性。除此之外,HDF提供了驱动模型的抽象、公共工具、外围器件框架等能力。开发者应该基于HDF提供的这些能力开发驱动,从而保证驱动程序可以在各种形态的OpenHarmony上进行部署。
+【说明】HDF驱动框架提供了驱动加载、驱动服务管理和驱动消息机制,同时还提供了操作系统抽象层(OSAL, Operating System Abstraction Layer)和平台抽象层(PAL, Platform Abstraction Layer)来保证驱动程序的跨系统跨平台部署的特性。除此之外,HDF提供了驱动模型的抽象、公共工具、外围器件框架等能力。开发者应该基于HDF提供的这些能力开发驱动,从而保证驱动程序可以在各种形态的OpenHarmony上进行部署。
#### 【规则】开发者应当遵循此规范要求,开发能够同时满足内核态和用户态的驱动
@@ -332,7 +332,7 @@ root {
#### 【建议】当preload字段配置为默认加载时,应当根据业务要求配置按序加载的优先级
-【说明】在HDF框架定义的device_info.hcs配置文件中,priority字段(取值范围为整数0到200)是用来表示Host和驱动的优先级。不同的Host内的驱动,Host的priority值越小,驱动加载优先级越高;同一个Host内驱动的priority值越小,加载优先级越高。priority字段的默认值为100,当未配置或字段值相同时,HDF框架将不保证驱动的加载顺序。开发者应当根据业务场景的要求,配置preority字段,保证各个驱动的启动顺序。
+【说明】在HDF框架定义的device_info.hcs配置文件中,priority字段(取值范围为整数0到200)是用来表示Host和驱动的优先级。不同的Host内的驱动,Host的priority值越小,驱动加载优先级越高;同一个Host内驱动的priority值越小,加载优先级越高。priority字段的默认值为100,当未配置或字段值相同时,HDF框架将不保证驱动的加载顺序。开发者应当根据业务场景的要求,配置priority字段,保证各个驱动的启动顺序。
【样例】
diff --git a/zh-cn/contribute/template/js-template.md b/zh-cn/contribute/template/js-template.md
index 4612480a72e4715594e7a9f41ea30f2b82af336c..24f948162f0da63d13a80fac1b770fe54b68bdf3 100644
--- a/zh-cn/contribute/template/js-template.md
+++ b/zh-cn/contribute/template/js-template.md
@@ -66,6 +66,12 @@
```js
import call from '@ohos.telephony.call';
```
+## 系统能力
+> *写作说明*
+>
+> 3.1 - 必选。
+>
+示例:SystemCapability.BundleManager.BundleFramework
## 属性
diff --git a/zh-cn/device-dev/get-code/gettools-acquire.md b/zh-cn/device-dev/get-code/gettools-acquire.md
index 9fe2e55209f388f28f3bddae6e5d6a75c2f95fa0..dc8a50e2512fb9d81540f85e30f573545bf987d2 100644
--- a/zh-cn/device-dev/get-code/gettools-acquire.md
+++ b/zh-cn/device-dev/get-code/gettools-acquire.md
@@ -43,7 +43,7 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完
|
swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker
|
-0.0.5
+ | 0.0.6
|