提交 e91b7d1a 编写于 作者: A Austin 提交者: Gitee

Merge branch 'OpenHarmony-3.1-Release' of gitee.com:openharmony/docs into OpenHarmony-3.1-Release

...@@ -231,7 +231,7 @@ You should override **onDestroy** to delete widget data. ...@@ -231,7 +231,7 @@ You should override **onDestroy** to delete widget data.
} }
``` ```
For details about the persistence method, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). For details about the persistence method, see [Lightweight Data Store Development](../database/database-storage-guidelines.md).
Note that the **Want** passed by the widget host to the widget provider contains a temporary flag, indicating whether the requested widget is a temporary one. Note that the **Want** passed by the widget host to the widget provider contains a temporary flag, indicating whether the requested widget is a temporary one.
......
# MissionSnapshot # MissionSnapshot
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides snapshot of a mission. Provides the snapshot of a mission.
## Modules to Import ## Modules to Import
......
...@@ -69,7 +69,7 @@ Checks whether this application is undergoing a stability test. This API uses a ...@@ -69,7 +69,7 @@ Checks whether this application is undergoing a stability test. This API uses a
isRamConstrainedDevice(): Promise\<boolean>; isRamConstrainedDevice(): Promise\<boolean>;
Checks whether this application is running in a RAM constrained device. This API uses a promise to return the result. Checks whether this application is running on a RAM constrained device. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -77,7 +77,7 @@ Checks whether this application is running in a RAM constrained device. This API ...@@ -77,7 +77,7 @@ Checks whether this application is running in a RAM constrained device. This API
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return whether the application is running in a RAM constrained device. If the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| | Promise&lt;boolean&gt; | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -93,7 +93,7 @@ Checks whether this application is running in a RAM constrained device. This API ...@@ -93,7 +93,7 @@ Checks whether this application is running in a RAM constrained device. This API
isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void; isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
Checks whether this application is running in a RAM constrained device. This API uses an asynchronous callback to return the result. Checks whether this application is running on a RAM constrained device. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -101,7 +101,7 @@ Checks whether this application is running in a RAM constrained device. This API ...@@ -101,7 +101,7 @@ Checks whether this application is running in a RAM constrained device. This API
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return whether the application is running in a RAM constrained device. If the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| | callback | AsyncCallback&lt;boolean&gt; | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -214,4 +214,4 @@ Obtains information about the running processes. This API uses an asynchronous c ...@@ -214,4 +214,4 @@ Obtains information about the running processes. This API uses an asynchronous c
| pid<sup>8+</sup> | Read only | number | No | Process ID. | | pid<sup>8+</sup> | Read only | number | No | Process ID. |
| uid<sup>8+</sup> | Read only | number | No | User ID.| | uid<sup>8+</sup> | Read only | number | No | User ID.|
| processName<sup>8+</sup> | Read only | string | No | Process name.| | processName<sup>8+</sup> | Read only | string | No | Process name.|
| bundleNames<sup>8+</sup> | Read only | Array\<string> | No | **bundleName** array in the running process.| | bundleNames<sup>8+</sup> | Read only | Array\<string> | No | **bundleName** array in the running processes.|
...@@ -8,7 +8,7 @@ The Battery Info module provides APIs for querying the charger type, battery hea ...@@ -8,7 +8,7 @@ The Battery Info module provides APIs for querying the charger type, battery hea
## Modules to Import<a name="section199443271307"></a> ## Modules to Import<a name="section199443271307"></a>
``` ```js
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
``` ```
...@@ -126,7 +126,7 @@ Describes battery information. ...@@ -126,7 +126,7 @@ Describes battery information.
- Example - Example
``` ```js
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
var batterySoc = batteryInfo.batterySOC; var batterySoc = batteryInfo.batterySOC;
``` ```
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
## Modules to Import ## Modules to Import
``` ```js
import bluetooth from '@ohos.bluetooth'; import bluetooth from '@ohos.bluetooth';
``` ```
......
...@@ -8,7 +8,7 @@ The Brightness module provides an API for setting the screen brightness. ...@@ -8,7 +8,7 @@ The Brightness module provides an API for setting the screen brightness.
## Modules to Import ## Modules to Import
``` ```js
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
``` ```
...@@ -30,6 +30,6 @@ This is a system API and cannot be called by third-party applications. ...@@ -30,6 +30,6 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
brightness.setValue(128); brightness.setValue(128);
``` ```
...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object. ...@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object.
- Example - Example
``` ```js
let xml = let xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
## Modules to Import ## Modules to Import
``` ```ts
import deviceInfo from '@ohos.deviceInfo' import deviceInfo from '@ohos.deviceInfo'
``` ```
......
# File Interaction
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
- The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
- The APIs of this module will be deprecated and are not recommended for use. An exception will be thrown if any of the APIs is called.
## Modules to Import
```js
import document from '@ohos.document';
```
## document.choose
choose(type:string[]): Promise&lt;string&gt;
Chooses a file of the specified type using the file manager. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------- |
| type | string[] | No | Type of the file to choose.|
- Return value
| Type | Description |
| --------------------- | -------------- |
| Promise&lt;string&gt; | Promise used to return the result. An error code is returned.|
- Example
```js
await document.choose(type);
```
## document.choose
choose(callback:AsyncCallback&lt;string&gt;): void
Chooses a file using the file manager. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned.|
- Example
```js
await document.choose(function(err, uri) {
// Do something with the URI.
});
```
## document.choose
choose(type:string[], callback:AsyncCallback&lt;string&gt;): void
Chooses a file of the specified type using the file manager. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| type | string[] | No | Type of the file to choose.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. An error code is returned.|
- Example
```js
await document.choose(type, function(err, uri) {
// Do something with the URI.
});
```
## document.show
show(url:string, type:string):Promise&lt;number&gt;
Opens a file. This method uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ---------------------------- |
| uri | string | Yes | URI of the file to open.|
| type | string | Yes | Type of the file to open.|
- Return value
| Type | Description |
| --------------------- | ------------ |
| Promise&lt;void&gt; | Promise used to return the result. An error code is returned.|
- Example
```js
await document.show(uri, type);
```
## document.show
show(url:string, type:string, callback:AsyncCallback&lt;void&gt;): void
Opens a file. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------- |
| uri | string | Yes | URI of the file to open.|
| type | string | Yes | Type of the file to open.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. An error code is returned. |
- Example
```js
await document.show(uri, type, function(err) {
//do something
});
```
...@@ -104,7 +104,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => { ...@@ -104,7 +104,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => {
readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses a callback to return the result. Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -126,7 +126,7 @@ pixelmap.readPixelsToBuffer(readBuffer, () => { ...@@ -126,7 +126,7 @@ pixelmap.readPixelsToBuffer(readBuffer, () => {
readPixels(area: PositionArea): Promise\<void> readPixels(area: PositionArea): Promise\<void>
Reads pixel map data in an area. This API uses a promise to return the data read. Reads image pixel map data in an area. This API uses a promise to return the data read.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -156,7 +156,7 @@ pixelmap.readPixels(area).then((data) => { ...@@ -156,7 +156,7 @@ pixelmap.readPixels(area).then((data) => {
readPixels(area: PositionArea, callback: AsyncCallback\<void>): void readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
Reads image pixel map data in an area. This API uses a callback to return the data read. Reads image pixel map data in an area. This API uses an asynchronous callback to return the data read.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -200,7 +200,7 @@ Writes image pixel map data to an area. This API uses a promise to return the op ...@@ -200,7 +200,7 @@ Writes image pixel map data to an area. This API uses a promise to return the op
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | -------------------- | | ------ | ------------------------------ | ---- | -------------------- |
| area | [PositionArea](#positionarea7) | Yes | Area to which the pixel map data will be written.| | area | [PositionArea](#positionarea7) | Yes | Area to which the image pixel map data will be written.|
**Return value** **Return value**
...@@ -250,7 +250,7 @@ image.createPixelMap(color, opts) ...@@ -250,7 +250,7 @@ image.createPixelMap(color, opts)
writePixels(area: PositionArea, callback: AsyncCallback\<void>): void writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
Writes image pixel map data to an area. This API uses a callback to return the operation result. Writes image pixel map data to an area. This API uses an asynchronous callback to return the operation result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -258,7 +258,7 @@ Writes image pixel map data to an area. This API uses a callback to return the o ...@@ -258,7 +258,7 @@ Writes image pixel map data to an area. This API uses a callback to return the o
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------------ | ---- | ------------------------------ | | --------- | ------------------------------ | ---- | ------------------------------ |
| area | [PositionArea](#positionarea7) | Yes | Area to which the pixel map data will be written. | | area | [PositionArea](#positionarea7) | Yes | Area to which the image pixel map data will be written. |
| callback: | AsyncCallback\<void> | Yes | Callback used to return the operation result. If the operation fails, an error message is returned.| | callback: | AsyncCallback\<void> | Yes | Callback used to return the operation result. If the operation fails, an error message is returned.|
**Example** **Example**
...@@ -308,7 +308,7 @@ pixelMap.writeBufferToPixels(colorBuffer).then(() => { ...@@ -308,7 +308,7 @@ pixelMap.writeBufferToPixels(colorBuffer).then(() => {
writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** object. This API uses a callback to return the result. Reads image data in an **ArrayBuffer** and writes the data to a **PixelMap** object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -335,7 +335,7 @@ pixelMap.writeBufferToPixels(colorBuffer, function(err) { ...@@ -335,7 +335,7 @@ pixelMap.writeBufferToPixels(colorBuffer, function(err) {
getImageInfo(): Promise\<ImageInfo> getImageInfo(): Promise\<ImageInfo>
Obtains pixel map information about this image. This API uses a promise to return the information. Obtains pixel map information of this image. This API uses a promise to return the information.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -359,7 +359,7 @@ pixelMap.getImageInfo().then(function(info) { ...@@ -359,7 +359,7 @@ pixelMap.getImageInfo().then(function(info) {
getImageInfo(callback: AsyncCallback\<ImageInfo>): void getImageInfo(callback: AsyncCallback\<ImageInfo>): void
Obtains pixel map information about this image. This API uses a callback to return the information. Obtains pixel map information of this image. This API uses an asynchronous callback to return the information.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -379,7 +379,7 @@ pixelmap.getImageInfo((imageInfo) => {}) ...@@ -379,7 +379,7 @@ pixelmap.getImageInfo((imageInfo) => {})
getBytesNumberPerRow(): number getBytesNumberPerRow(): number
Obtains the number of bytes in each line of the image pixel map. Obtains the number of bytes per line of the image pixel map.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -387,7 +387,7 @@ Obtains the number of bytes in each line of the image pixel map. ...@@ -387,7 +387,7 @@ Obtains the number of bytes in each line of the image pixel map.
| Type | Description | | Type | Description |
| ------ | -------------------- | | ------ | -------------------- |
| number | Number of bytes in each line.| | number | Number of bytes per line.|
**Example** **Example**
...@@ -440,7 +440,7 @@ Releases this **PixelMap** object. This API uses a promise to return the result. ...@@ -440,7 +440,7 @@ Releases this **PixelMap** object. This API uses a promise to return the result.
release(callback: AsyncCallback\<void>): void release(callback: AsyncCallback\<void>): void
Releases this **PixelMap** object. This API uses a callback to return the result. Releases this **PixelMap** object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -522,7 +522,7 @@ Provides APIs to obtain image information. Before calling any API in **ImageSour ...@@ -522,7 +522,7 @@ Provides APIs to obtain image information. Before calling any API in **ImageSour
getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void
Obtains information about an image with the specified index. This API uses a callback to return the information. Obtains information about an image with the specified index. This API uses an asynchronous callback to return the information.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -543,7 +543,7 @@ imageSourceApi.getImageInfo(0,(error, imageInfo) => {}) ...@@ -543,7 +543,7 @@ imageSourceApi.getImageInfo(0,(error, imageInfo) => {})
getImageInfo(callback: AsyncCallback\<ImageInfo>): void getImageInfo(callback: AsyncCallback\<ImageInfo>): void
Obtains information about this image. This API uses a callback to return the information. Obtains information about this image. This API uses an asynchronous callback to return the information.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -620,7 +620,7 @@ imageSourceApi.getImageProperty("BitsPerSample") ...@@ -620,7 +620,7 @@ imageSourceApi.getImageProperty("BitsPerSample")
getImageProperty(key:string, callback: AsyncCallback\<string>): void getImageProperty(key:string, callback: AsyncCallback\<string>): void
Obtains the value of a property with the specified index in this image. This API uses a callback to return the result. Obtains the value of a property with the specified index in this image. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -641,7 +641,7 @@ imageSourceApi.getImageProperty("BitsPerSample",(error,data) => {}) ...@@ -641,7 +641,7 @@ imageSourceApi.getImageProperty("BitsPerSample",(error,data) => {})
getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCallback\<string>): void getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCallback\<string>): void
Obtains the value of a property in this image. This API uses a callback to return the property value in a string. Obtains the value of a property in this image. This API uses an asynchronous callback to return the property value in a string.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -663,7 +663,7 @@ imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => {}) ...@@ -663,7 +663,7 @@ imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => {})
createPixelMap(options?: DecodingOptions): Promise\<PixelMap> createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
Creates a **PixelMap** object based on image decoding parameters. This API uses a callback to return the result. Creates a **PixelMap** object based on image decoding parameters. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -690,7 +690,7 @@ imageSourceApi.createPixelMap().then(pixelmap => {}) ...@@ -690,7 +690,7 @@ imageSourceApi.createPixelMap().then(pixelmap => {})
createPixelMap(callback: AsyncCallback\<PixelMap>): void createPixelMap(callback: AsyncCallback\<PixelMap>): void
Creates a **PixelMap** object based on the default parameters. This API uses a callback to return the result. Creates a **PixelMap** object based on the default parameters. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -710,7 +710,7 @@ imageSourceApi.createPixelMap(pixelmap => {}) ...@@ -710,7 +710,7 @@ imageSourceApi.createPixelMap(pixelmap => {})
createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): void createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): void
Creates a **PixelMap** object based on image decoding parameters. This API uses a callback to return the result. Creates a **PixelMap** object based on image decoding parameters. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -731,7 +731,7 @@ imageSourceApi.createPixelMap(decodingOptions, pixelmap => {}) ...@@ -731,7 +731,7 @@ imageSourceApi.createPixelMap(decodingOptions, pixelmap => {})
release(callback: AsyncCallback\<void>): void release(callback: AsyncCallback\<void>): void
Releases this **ImageSource** instance. This API uses a callback to return the result. Releases this **ImageSource** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -801,7 +801,7 @@ Provide APIs to pack images. Before calling any API in **ImagePacker**, you must ...@@ -801,7 +801,7 @@ Provide APIs to pack images. Before calling any API in **ImagePacker**, you must
packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<Array\<ArrayBuffer>>): void packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<Array\<ArrayBuffer>>): void
Packs an image. This API uses a callback to return the result. Packs an image. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -854,7 +854,7 @@ imagePackerApi.packing(imageSourceApi, packOpts) ...@@ -854,7 +854,7 @@ imagePackerApi.packing(imageSourceApi, packOpts)
packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayBuffer>): void packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayBuffer>): void
Packs an image. This API uses a callback to return the result. Packs an image. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -907,7 +907,7 @@ imagePackerApi.packing(pixelMapApi, packOpts) ...@@ -907,7 +907,7 @@ imagePackerApi.packing(pixelMapApi, packOpts)
release(callback: AsyncCallback\<void>): void release(callback: AsyncCallback\<void>): void
Releases this **ImagePacker** instance. This API uses a callback to return the result. Releases this **ImagePacker** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.Image **System capability**: SystemCapability.Multimedia.Image
...@@ -1058,7 +1058,7 @@ Describes the exchangeable image file format (Exif) information of an image. ...@@ -1058,7 +1058,7 @@ Describes the exchangeable image file format (Exif) information of an image.
| Name | Default Value | Description | | Name | Default Value | Description |
| ----------------- | ----------------- | -------------------- | | ----------------- | ----------------- | -------------------- |
| BITS_PER_SAMPLE | "BitsPerSample" | Number of bytes in each pixel. | | BITS_PER_SAMPLE | "BitsPerSample" | Number of bits per pixel. |
| ORIENTATION | "Orientation" | Image orientation. | | ORIENTATION | "Orientation" | Image orientation. |
| IMAGE_LENGTH | "ImageLength" | Image length. | | IMAGE_LENGTH | "ImageLength" | Image length. |
| IMAGE_WIDTH | "ImageWidth" | Image width. | | IMAGE_WIDTH | "ImageWidth" | Image width. |
......
...@@ -8,7 +8,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste ...@@ -8,7 +8,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste
## Modules to Import ## Modules to Import
``` ```js
import power from '@ohos.power'; import power from '@ohos.power';
``` ```
...@@ -35,7 +35,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -35,7 +35,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
power.shutdownDevice("shutdown_test"); power.shutdownDevice("shutdown_test");
console.info('power_shutdown_device_test success') console.info('power_shutdown_device_test success')
``` ```
...@@ -57,7 +57,7 @@ Reboots the system. ...@@ -57,7 +57,7 @@ Reboots the system.
**Example** **Example**
``` ```js
power.rebootDevice("reboot_test"); power.rebootDevice("reboot_test");
console.info('power_reboot_device_test success') console.info('power_reboot_device_test success')
``` ```
...@@ -77,7 +77,7 @@ Checks the screen status of the current device. ...@@ -77,7 +77,7 @@ Checks the screen status of the current device.
**Example** **Example**
``` ```js
power.isScreenOn((error, screenOn) => { power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") { if (typeof error === "undefined") {
console.info('screenOn status is ' + screenOn); console.info('screenOn status is ' + screenOn);
...@@ -101,7 +101,7 @@ Checks the screen status of the current device. ...@@ -101,7 +101,7 @@ Checks the screen status of the current device.
**Example** **Example**
``` ```js
power.isScreenOn() power.isScreenOn()
.then(screenOn => { .then(screenOn => {
console.info('screenOn status is ' + screenOn); console.info('screenOn status is ' + screenOn);
......
...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi ...@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ Obtains the standard output of the child process. ...@@ -85,7 +85,7 @@ Obtains the standard output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process. ...@@ -110,7 +110,7 @@ Obtains the standard error output of the child process.
**Example** **Example**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ Closes the child process in running. ...@@ -129,7 +129,7 @@ Closes the child process in running.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it. ...@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it.
**Example** **Example**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ Checks whether this process is isolated. ...@@ -173,7 +173,7 @@ Checks whether this process is isolated.
**Example** **Example**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app. ...@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app.
**Example** **Example**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment. ...@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment.
**Example** **Example**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name. ...@@ -248,7 +248,7 @@ Obtains the process UID based on the process name.
**Example** **Example**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID. ...@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID.
**Example** **Example**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti ...@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
**Example** **Example**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c ...@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example** **Example**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ Obtains the system configuration. ...@@ -344,7 +344,7 @@ Obtains the system configuration.
**Example** **Example**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ Obtains the value of an environment variable. ...@@ -372,7 +372,7 @@ Obtains the value of an environment variable.
**Example** **Example**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje ...@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje
**Example** **Example**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to ...@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to
**Example** **Example**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ Stores the events triggered by the user. ...@@ -455,7 +455,7 @@ Stores the events triggered by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ Deletes the event stored by the user. ...@@ -484,7 +484,7 @@ Deletes the event stored by the user.
**Example** **Example**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ Exercise caution when using this API. ...@@ -510,7 +510,7 @@ Exercise caution when using this API.
**Example** **Example**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ Obtains the working directory of this process. ...@@ -525,7 +525,7 @@ Obtains the working directory of this process.
**Example** **Example**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ Changes the working directory of this process. ...@@ -546,7 +546,7 @@ Changes the working directory of this process.
**Example** **Example**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ Obtains the running time of this process. ...@@ -567,7 +567,7 @@ Obtains the running time of this process.
**Example** **Example**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it. ...@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it.
| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| | boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.|
**Example** **Example**
``` ```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
## Modules to Import ## Modules to Import
``` ```js
import screenlock from '@ohos.screenLock'; import screenlock from '@ohos.screenLock';
``` ```
...@@ -28,7 +28,7 @@ Checks whether the screen is locked. This method uses an asynchronous callback t ...@@ -28,7 +28,7 @@ Checks whether the screen is locked. This method uses an asynchronous callback t
- Example - Example
``` ```js
screenlock.isScreenLocked((err, data)=>{ screenlock.isScreenLocked((err, data)=>{
if (err) { if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}'); console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
...@@ -54,7 +54,7 @@ Checks whether the screen is locked. This method uses a promise to return the re ...@@ -54,7 +54,7 @@ Checks whether the screen is locked. This method uses a promise to return the re
- Example - Example
``` ```js
screenlock.isScreenLocked().then((data) => { screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}'); console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => { }).catch((err) => {
...@@ -81,7 +81,7 @@ Checks whether a device is in secure mode. This method uses an asynchronous call ...@@ -81,7 +81,7 @@ Checks whether a device is in secure mode. This method uses an asynchronous call
- Example - Example
``` ```js
screenlock.isSecureMode((err, data)=>{ screenlock.isSecureMode((err, data)=>{
if (err) { if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}'); console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
...@@ -107,7 +107,7 @@ Checks whether a device is in secure mode. This method uses a promise to return ...@@ -107,7 +107,7 @@ Checks whether a device is in secure mode. This method uses a promise to return
- Example - Example
``` ```js
screenlock.isSecureMode().then((data) => { screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}'); console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => { }).catch((err) => {
...@@ -134,7 +134,7 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu ...@@ -134,7 +134,7 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu
- Example - Example
``` ```js
screenlock.unlockScreen((err)=>{ screenlock.unlockScreen((err)=>{
if (err) { if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}'); console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
...@@ -160,7 +160,7 @@ Unlocks the screen. This method uses a promise to return the result. ...@@ -160,7 +160,7 @@ Unlocks the screen. This method uses a promise to return the result.
- Example - Example
``` ```js
screenlock.unlockScreen().then(() => { screenlock.unlockScreen().then(() => {
console.log('unlockScreen success'); console.log('unlockScreen success');
}).catch((err) => { }).catch((err) => {
......
...@@ -9,7 +9,7 @@ This module provides APIs for setting data items. ...@@ -9,7 +9,7 @@ This module provides APIs for setting data items.
## Modules to Import ## Modules to Import
``` ```typescript
import settings from '@ohos.settings'; import settings from '@ohos.settings';
``` ```
...@@ -34,7 +34,7 @@ Obtains the URI of a data item. ...@@ -34,7 +34,7 @@ Obtains the URI of a data item.
| string | URI of the data item.| | string | URI of the data item.|
- Example - Example
``` ```typescript
// Obtain the URI of a data item. // Obtain the URI of a data item.
let urivar = settings.getUriSync('settings.screen.brightness'); let urivar = settings.getUriSync('settings.screen.brightness');
``` ```
...@@ -61,7 +61,7 @@ Obtains the value of a data item. ...@@ -61,7 +61,7 @@ Obtains the value of a data item.
| string | Value of the data item.| | string | Value of the data item.|
- Example - Example
``` ```typescript
import featureAbility from '@ohos.featureAbility'; import featureAbility from '@ohos.featureAbility';
// Obtain the value of 'settings.screen.brightness' (this data item already exists in the database). // Obtain the value of 'settings.screen.brightness' (this data item already exists in the database).
...@@ -96,7 +96,7 @@ If the specified data item exists in the database, the **setValueSync** method u ...@@ -96,7 +96,7 @@ If the specified data item exists in the database, the **setValueSync** method u
| boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.| | boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.|
- Example - Example
``` ```typescript
import featureAbility from '@ohos.featureAbility'; import featureAbility from '@ohos.featureAbility';
// Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync // Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync
......
...@@ -138,7 +138,7 @@ Sets the maximum size (in bytes) of the image data cached in the memory before d ...@@ -138,7 +138,7 @@ Sets the maximum size (in bytes) of the image data cached in the memory before d
export default { export default {
onCreate() { onCreate() {
app.setImageRawDataCacheSize(104,857,600) // Set the upper limit of the memory for caching image data before decoding to 100 MB. app.setImageRawDataCacheSize(100) // Set the upper limit of the memory for caching image data before decoding to 100 MB.
console.info('Application onCreate') console.info('Application onCreate')
}, },
onDestroy() { onDestroy() {
...@@ -168,7 +168,7 @@ Sets the maximum size of the image file cache (in bytes) to speed up the loading ...@@ -168,7 +168,7 @@ Sets the maximum size of the image file cache (in bytes) to speed up the loading
export default { export default {
onCreate() { onCreate() {
app.setImageFileCacheSize(209,715,200) // Set the upper limit of the image file cache to 200 MB. app.setImageFileCacheSize(200) // Set the upper limit of the image file cache to 200 MB.
console.info('Application onCreate') console.info('Application onCreate')
}, },
onDestroy() { onDestroy() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## Modules to Import ## Modules to Import
``` ```js
import battery from '@system.battery'; import battery from '@system.battery';
``` ```
...@@ -39,7 +39,7 @@ The following value will be returned when the check result is obtained. ...@@ -39,7 +39,7 @@ The following value will be returned when the check result is obtained.
**Example** **Example**
``` ```js
export default { export default {
getStatus() { getStatus() {
battery.getStatus({ battery.getStatus({
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## Modules to Import ## Modules to Import
``` ```js
import brightness from '@system.brightness'; import brightness from '@system.brightness';
``` ```
...@@ -38,7 +38,7 @@ The following values will be returned when the operation is successful. ...@@ -38,7 +38,7 @@ The following values will be returned when the operation is successful.
**Example** **Example**
``` ```js
export default { export default {
getValue() { getValue() {
brightness.getValue({ brightness.getValue({
...@@ -73,7 +73,7 @@ Sets the screen brightness. ...@@ -73,7 +73,7 @@ Sets the screen brightness.
**Example** **Example**
``` ```js
export default { export default {
setValue() { setValue() {
brightness.setValue({ brightness.setValue({
...@@ -114,7 +114,7 @@ The following values will be returned when the operation is successful. ...@@ -114,7 +114,7 @@ The following values will be returned when the operation is successful.
**Example** **Example**
``` ```js
export default { export default {
getMode() { getMode() {
brightness.getMode({ brightness.getMode({
...@@ -149,7 +149,7 @@ Sets the screen brightness adjustment mode. ...@@ -149,7 +149,7 @@ Sets the screen brightness adjustment mode.
**Example** **Example**
``` ```js
export default { export default {
setMode() { setMode() {
brightness.setMode({ brightness.setMode({
...@@ -185,7 +185,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**. ...@@ -185,7 +185,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**.
**Example** **Example**
``` ```js
export default { export default {
setKeepScreenOn() { setKeepScreenOn() {
brightness.setKeepScreenOn({ brightness.setKeepScreenOn({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```ts
import parameter from '@ohos.systemParameter' import parameter from '@ohos.systemParameter'
``` ```
...@@ -34,7 +34,7 @@ Obtains the value of the attribute with the specified key. ...@@ -34,7 +34,7 @@ Obtains the value of the attribute with the specified key.
**Example** **Example**
``` ```ts
try { try {
var info = parameter.getSync("test.parameter.key"); var info = parameter.getSync("test.parameter.key");
console.log(JSON.stringify(info)); console.log(JSON.stringify(info));
...@@ -61,7 +61,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn ...@@ -61,7 +61,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn
**Example** **Example**
``` ```ts
try { try {
parameter.get("test.parameter.key", function (err, data) { parameter.get("test.parameter.key", function (err, data) {
if (err == undefined) { if (err == undefined) {
...@@ -93,7 +93,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn ...@@ -93,7 +93,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn
**Example** **Example**
``` ```ts
try { try {
parameter.get("test.parameter.key", "default", function (err, data) { parameter.get("test.parameter.key", "default", function (err, data) {
if (err == undefined) { if (err == undefined) {
...@@ -131,7 +131,7 @@ Obtains the value of the attribute with the specified key. This API uses a promi ...@@ -131,7 +131,7 @@ Obtains the value of the attribute with the specified key. This API uses a promi
**Example** **Example**
``` ```ts
try { try {
var p = parameter.get("test.parameter.key"); var p = parameter.get("test.parameter.key");
p.then(function (value) { p.then(function (value) {
...@@ -162,7 +162,7 @@ Sets a value for the attribute with the specified key. ...@@ -162,7 +162,7 @@ Sets a value for the attribute with the specified key.
**Example** **Example**
``` ```ts
try { try {
parameter.setSync("test.parameter.key", "default"); parameter.setSync("test.parameter.key", "default");
}catch(e){ }catch(e){
...@@ -189,7 +189,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro ...@@ -189,7 +189,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro
**Example** **Example**
``` ```ts
try { try {
parameter.set("test.parameter.key", "testValue", function (err, data) { parameter.set("test.parameter.key", "testValue", function (err, data) {
if (err == undefined) { if (err == undefined) {
...@@ -226,7 +226,7 @@ Sets a value for the attribute with the specified key. This API uses a promise t ...@@ -226,7 +226,7 @@ Sets a value for the attribute with the specified key. This API uses a promise t
**Example** **Example**
``` ```ts
try { try {
var p = para.set("test.parameter.key", "testValue"); var p = para.set("test.parameter.key", "testValue");
p.then(function (value) { p.then(function (value) {
......
...@@ -8,7 +8,7 @@ This module provides thermal level-related callback and query APIs to obtain the ...@@ -8,7 +8,7 @@ This module provides thermal level-related callback and query APIs to obtain the
## Modules to Import ## Modules to Import
``` ```js
import thermal from '@ohos.thermal'; import thermal from '@ohos.thermal';
``` ```
...@@ -46,7 +46,7 @@ Subscribes to thermal level changes. ...@@ -46,7 +46,7 @@ Subscribes to thermal level changes.
**Example** **Example**
``` ```js
var lev = 0; var lev = 0;
thermal.subscribeThermalLevel((lev) => { thermal.subscribeThermalLevel((lev) => {
console.info("Thermal level is: " + lev); console.info("Thermal level is: " + lev);
...@@ -69,7 +69,7 @@ Unsubscribes from thermal level changes. ...@@ -69,7 +69,7 @@ Unsubscribes from thermal level changes.
**Example** **Example**
``` ```js
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("Unsubscribe completed."); console.info("Unsubscribe completed.");
}); });
...@@ -91,7 +91,7 @@ Obtains the current thermal level. ...@@ -91,7 +91,7 @@ Obtains the current thermal level.
**Example** **Example**
``` ```js
var lev = thermal.getThermalLevel(); var lev = thermal.getThermalLevel();
console.info("Thermal level is: " + lev); console.info("Thermal level is: " + lev);
``` ```
...@@ -46,11 +46,11 @@ A constructor used to create a URI instance. ...@@ -46,11 +46,11 @@ A constructor used to create a URI instance.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
``` ```js
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL. ...@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL.
**Example** **Example**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object. ...@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object.
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi ...@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ Normalizes the path of this URI. ...@@ -134,7 +134,7 @@ Normalizes the path of this URI.
| URI | URI with the normalized path.| | URI | URI with the normalized path.|
**Example** **Example**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance. ...@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance.
**Example** **Example**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string. ...@@ -55,7 +55,7 @@ Appends a key-value pair into the query string.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key. ...@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key. ...@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal ...@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Example** **Example**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key.
**Example** **Example**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ Checks whether a key has a value. ...@@ -213,7 +213,7 @@ Checks whether a key has a value.
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Example** **Example**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi ...@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example** **Example**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example** **Example**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Example** **Example**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ Creates a URL. ...@@ -386,7 +386,7 @@ Creates a URL.
**Example** **Example**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; var a = new URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new URL(mm); // Output 'http://username:password@host:8080/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ Converts the parsed URL into a string. ...@@ -416,7 +416,7 @@ Converts the parsed URL into a string.
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string. ...@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string.
| string | Website address in a serialized string.| | string | Website address in a serialized string.|
**Example** **Example**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -23,18 +23,18 @@ Prints the input content in a formatted string. ...@@ -23,18 +23,18 @@ Prints the input content in a formatted string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| format | string | Yes| Format of the string to print.| | format | string | Yes| Format of the string to print.|
| ...args | Object[] | No| Data to format.| | ...args | Object[] | No| Data to format.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String in the specified format.| | string | String in the specified format.|
**Example** **Example**
``` ```js
var res = util.printf("%s", "hello world!"); var res = util.printf("%s", "hello world!");
console.log(res); console.log(res);
``` ```
...@@ -49,17 +49,17 @@ Obtains detailed information about a system error code. ...@@ -49,17 +49,17 @@ Obtains detailed information about a system error code.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| errno | number | Yes| Error code generated.| | errno | number | Yes| Error code generated.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Detailed information about the error code.| | string | Detailed information about the error code.|
**Example** **Example**
``` ```js
var errnum = 10; // 10 is the system error code. var errnum = 10; // 10 is the system error code.
var result = util.getErrorString(errnum); var result = util.getErrorString(errnum);
console.log("result = " + result); console.log("result = " + result);
...@@ -76,17 +76,17 @@ Calls back an asynchronous function. In the callback, the first parameter indica ...@@ -76,17 +76,17 @@ Calls back an asynchronous function. In the callback, the first parameter indica
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes| Asynchronous function.| | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value.| | Function | Callback, in which the first parameter indicates the cause of the rejection (the value is **null** if the promise has been resolved) and the second parameter indicates the resolved value.|
**Example** **Example**
``` ```js
async function promiseFn() { async function promiseFn() {
return Promise.reject('value'); return Promise.reject('value');
} }
...@@ -107,17 +107,17 @@ Processes an asynchronous function and returns a promise version. ...@@ -107,17 +107,17 @@ Processes an asynchronous function and returns a promise version.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | Yes| Asynchronous function.| | original | Function | Yes| Asynchronous function.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.| | Function | Function in the error-first style (that is, **(err, value) =>...** is called as the last parameter) and the promise version.|
**Example** **Example**
``` ```js
function aysnFun(str1, str2, callback) { function aysnFun(str1, str2, callback) {
if (typeof str1 === 'string' && typeof str2 === 'string') { if (typeof str1 === 'string' && typeof str2 === 'string') {
callback(null, str1 + str2); callback(null, str1 + str2);
...@@ -154,20 +154,20 @@ A constructor used to create a **TextDecoder** object. ...@@ -154,20 +154,20 @@ A constructor used to create a **TextDecoder** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| encoding | string | No| Encoding format.| | encoding | string | No| Encoding format.|
| options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.| | options | Object | No| Encoding-related options, which include **fatal** and **ignoreBOM**.|
**Table 1** options **Table 1** options
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fatal | boolean | No| Whether to display fatal errors.| | fatal | boolean | No| Whether to display fatal errors.|
| ignoreBOM | boolean | No| Whether to ignore the BOM.| | ignoreBOM | boolean | No| Whether to ignore the BOM.|
**Example** **Example**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
...@@ -181,24 +181,24 @@ Decodes the input content. ...@@ -181,24 +181,24 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | Unit8Array | Yes| Uint8Array to decode.| | input | Unit8Array | Yes| Uint8Array to decode.|
| options | Object | No| Options related to decoding.| | options | Object | No| Options related to decoding.|
**Table 2** options **Table 2** options
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stream | boolean | No| Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**.| | stream | boolean | No| Whether to allow data blocks in subsequent **decode()**. If data is processed in blocks, set this parameter to **true**. If this is the last data block to process or data is not divided into blocks, set this parameter to **false**. The default value is **false**.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Data decoded.| | string | Data decoded.|
**Example** **Example**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
...@@ -236,7 +236,7 @@ A constructor used to create a **TextEncoder** object. ...@@ -236,7 +236,7 @@ A constructor used to create a **TextEncoder** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
``` ```
...@@ -250,17 +250,17 @@ Encodes the input content. ...@@ -250,17 +250,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes| String to encode.| | input | string | Yes| String to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text.| | Uint8Array | Encoded text.|
**Example** **Example**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
var result = new Uint8Array(buffer); var result = new Uint8Array(buffer);
result = textEncoder.encode("\uD800¥¥"); result = textEncoder.encode("\uD800¥¥");
...@@ -276,18 +276,18 @@ Stores the UTF-8 encoded text. ...@@ -276,18 +276,18 @@ Stores the UTF-8 encoded text.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | Yes| String to encode.| | input | string | Yes| String to encode.|
| dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.| | dest | Uint8Array | Yes| **Uint8Array** instance used to store the UTF-8 encoded text.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Encoded text.| | Uint8Array | Encoded text.|
**Example** **Example**
``` ```js
var that = new util.TextEncoder(); var that = new util.TextEncoder();
var buffer = new ArrayBuffer(4); var buffer = new ArrayBuffer(4);
this.dest = new Uint8Array(buffer); this.dest = new Uint8Array(buffer);
...@@ -306,13 +306,13 @@ A constructor used to create a **RationalNumber** object. ...@@ -306,13 +306,13 @@ A constructor used to create a **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| numerator | number | Yes| Numerator, which is an integer.| | numerator | number | Yes| Numerator, which is an integer.|
| denominator | number | Yes| Denominator, which is an integer.| | denominator | number | Yes| Denominator, which is an integer.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
``` ```
...@@ -326,17 +326,17 @@ Creates a **RationalNumber** object based on the given string. ...@@ -326,17 +326,17 @@ Creates a **RationalNumber** object based on the given string.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rationalString | string | Yes| String used to create the **RationalNumber** object.| | rationalString | string | Yes| String used to create the **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| object | **RationalNumber** object created.| | object | **RationalNumber** object created.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
``` ```
...@@ -351,17 +351,18 @@ Compares this **RationalNumber** object with a given object. ...@@ -351,17 +351,18 @@ Compares this **RationalNumber** object with a given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.| | another | RationalNumber | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object.| | number | Returns **0** if the two objects are equal; returns **1** if the given object is less than this object; return **-1** if the given object is greater than this object.|
**Example** **Example**
```
```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.compareTo(rational); var result = rationalNumber.compareTo(rational);
...@@ -377,12 +378,12 @@ Obtains the value of this **RationalNumber** object as an integer or a floating- ...@@ -377,12 +378,12 @@ Obtains the value of this **RationalNumber** object as an integer or a floating-
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | An integer or a floating-point number.| | number | An integer or a floating-point number.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.valueOf(); var result = rationalNumber.valueOf();
``` ```
...@@ -397,17 +398,17 @@ Checks whether this **RationalNumber** object equals the given object. ...@@ -397,17 +398,17 @@ Checks whether this **RationalNumber** object equals the given object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | Object | Yes| Object used to compare with this **RationalNumber** object.| | object | Object | Yes| Object used to compare with this **RationalNumber** object.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the two objects are equal; returns **false** otherwise.| | boolean | Returns **true** if the two objects are equal; returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.equals(rational); var result = rationalNumber.equals(rational);
...@@ -423,18 +424,18 @@ Obtains the greatest common divisor of two specified integers. ...@@ -423,18 +424,18 @@ Obtains the greatest common divisor of two specified integers.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| number1 | number | Yes| The first integer used to get the greatest common divisor.| | number1 | number | Yes| The first integer used to get the greatest common divisor.|
| number2 | number | Yes| The second integer used to get the greatest common divisor.| | number2 | number | Yes| The second integer used to get the greatest common divisor.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Greatest common divisor obtained.| | number | Greatest common divisor obtained.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getCommonDivisor(4,6); var result = rationalNumber.getCommonDivisor(4,6);
``` ```
...@@ -450,12 +451,12 @@ Obtains the numerator of this **RationalNumber** object. ...@@ -450,12 +451,12 @@ Obtains the numerator of this **RationalNumber** object.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Numerator of this **RationalNumber** object.| | number | Numerator of this **RationalNumber** object.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getNumerator(); var result = rationalNumber.getNumerator();
``` ```
...@@ -470,12 +471,12 @@ Obtains the denominator of this **RationalNumber** object. ...@@ -470,12 +471,12 @@ Obtains the denominator of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Denominator of this **RationalNumber** object.| | number | Denominator of this **RationalNumber** object.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getDenominator(); var result = rationalNumber.getDenominator();
``` ```
...@@ -490,12 +491,12 @@ Checks whether this **RationalNumber** object is **0**. ...@@ -490,12 +491,12 @@ Checks whether this **RationalNumber** object is **0**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.| | boolean | Returns **true** if the value of this **RationalNumber** object is **0**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isZero(); var result = rationalNumber.isZero();
``` ```
...@@ -510,12 +511,12 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ...@@ -510,12 +511,12 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN).
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.| | boolean | Returns **true** if this **RationalNumber** object is a NaN (the denominator and numerator are both **0**); returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isNaN(); var result = rationalNumber.isNaN();
``` ```
...@@ -530,12 +531,12 @@ Checks whether this **RationalNumber** object represents a finite value. ...@@ -530,12 +531,12 @@ Checks whether this **RationalNumber** object represents a finite value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.| | boolean | Returns **true** if this **RationalNumber** object represents a finite value (the denominator is not **0**); returns **false** otherwise.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isFinite(); var result = rationalNumber.isFinite();
``` ```
...@@ -550,12 +551,12 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -550,12 +551,12 @@ Obtains the string representation of this **RationalNumber** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**.| | string | Returns **NaN** if the numerator and denominator of this object are both **0**; returns a string in Numerator/Denominator format otherwise, for example, **3/5**.|
**Example** **Example**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.toString(); var result = rationalNumber.toString();
``` ```
...@@ -571,7 +572,7 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -571,7 +572,7 @@ Obtains the string representation of this **RationalNumber** object.
| length | number | Yes| No| Total number of values in this buffer.| | length | number | Yes| No| Total number of values in this buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(1,8); pro.put(1,8);
...@@ -588,12 +589,12 @@ A constructor used to create an **LruBuffer** instance. The default capacity of ...@@ -588,12 +589,12 @@ A constructor used to create an **LruBuffer** instance. The default capacity of
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| capacity | number | No| Capacity of the **LruBuffer** to create.| | capacity | number | No| Capacity of the **LruBuffer** to create.|
**Example** **Example**
``` ```js
var lrubuffer= new util.LruBuffer(); var lrubuffer= new util.LruBuffer();
``` ```
...@@ -607,12 +608,12 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to ...@@ -607,12 +608,12 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| newCapacity | number | Yes| New capacity of the **LruBuffer**.| | newCapacity | number | Yes| New capacity of the **LruBuffer**.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.updateCapacity(100); var result = pro.updateCapacity(100);
``` ```
...@@ -627,12 +628,12 @@ Obtains the string representation of this **LruBuffer** object. ...@@ -627,12 +628,12 @@ Obtains the string representation of this **LruBuffer** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation of this **LruBuffer** object.| | string | String representation of this **LruBuffer** object.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -650,12 +651,12 @@ Obtains the capacity of this buffer. ...@@ -650,12 +651,12 @@ Obtains the capacity of this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Capacity of this buffer.| | number | Capacity of this buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.getCapacity(); var result = pro.getCapacity();
``` ```
...@@ -670,7 +671,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c ...@@ -670,7 +671,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.size(); var result = pro.size();
...@@ -687,12 +688,12 @@ Obtains the number of return values for **createDefault()**. ...@@ -687,12 +688,12 @@ Obtains the number of return values for **createDefault()**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of return values for **createDefault()**.| | number | Number of return values for **createDefault()**.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(1,8); pro.put(1,8);
var result = pro.getCreateCount(); var result = pro.getCreateCount();
...@@ -708,12 +709,12 @@ Obtains the number of times that the queried values are mismatched. ...@@ -708,12 +709,12 @@ Obtains the number of times that the queried values are mismatched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are mismatched.| | number | Number of times that the queried values are mismatched.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -730,12 +731,12 @@ Obtains the number of removals from this buffer. ...@@ -730,12 +731,12 @@ Obtains the number of removals from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of removals from the buffer.| | number | Number of removals from the buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.updateCapacity(2); pro.updateCapacity(2);
...@@ -753,12 +754,12 @@ Obtains the number of times that the queried values are matched. ...@@ -753,12 +754,12 @@ Obtains the number of times that the queried values are matched.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of times that the queried values are matched.| | number | Number of times that the queried values are matched.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -775,12 +776,12 @@ Obtains the number of additions to this buffer. ...@@ -775,12 +776,12 @@ Obtains the number of additions to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Number of additions to the buffer.| | number | Number of additions to the buffer.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.getPutCount(); var result = pro.getPutCount();
...@@ -796,12 +797,12 @@ Checks whether this buffer is empty. ...@@ -796,12 +797,12 @@ Checks whether this buffer is empty.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer does not contain any value.| | boolean | Returns **true** if the buffer does not contain any value.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.isEmpty(); var result = pro.isEmpty();
...@@ -817,17 +818,17 @@ Obtains the value of the specified key. ...@@ -817,17 +818,17 @@ Obtains the value of the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key based on which the value is queried.| | key | K | Yes| Key based on which the value is queried.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.| | V&nbsp;\|&nbsp;undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.get(2); var result = pro.get(2);
...@@ -843,18 +844,18 @@ Adds a key-value pair to this buffer. ...@@ -843,18 +844,18 @@ Adds a key-value pair to this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key of the key-value pair to add.| | key | K | Yes| Key of the key-value pair to add.|
| value | V | Yes| Value of the key-value pair to add.| | value | V | Yes| Value of the key-value pair to add.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. | | V | Returns the existing value if the key already exists; returns the value added otherwise. If the key or value is null, an exception will be thrown. |
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.put(2,10); var result = pro.put(2,10);
``` ```
...@@ -869,12 +870,12 @@ Obtains all values in this buffer, listed from the most to the least recently ac ...@@ -869,12 +870,12 @@ Obtains all values in this buffer, listed from the most to the least recently ac
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;[] | All values in the buffer, listed from the most to the least recently accessed.| | V&nbsp;[] | All values in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(2,"anhu"); pro.put(2,"anhu");
...@@ -892,12 +893,12 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ...@@ -892,12 +893,12 @@ Obtains all keys in this buffer, listed from the most to the least recently acce
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| K&nbsp;[] | All keys in the buffer, listed from the most to the least recently accessed.| | K&nbsp;[] | All keys in the buffer, listed from the most to the least recently accessed.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.keys(); var result = pro.keys();
...@@ -913,17 +914,17 @@ Removes the specified key and its value from this buffer. ...@@ -913,17 +914,17 @@ Removes the specified key and its value from this buffer.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key to remove.| | key | K | Yes| Key to remove.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.| | V&nbsp;\|&nbsp;undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.remove(20); var result = pro.remove(20);
...@@ -939,15 +940,15 @@ Performs subsequent operations after a value is removed. ...@@ -939,15 +940,15 @@ Performs subsequent operations after a value is removed.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| isEvict | boolean | No| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.| | isEvict | boolean | No| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.|
| key | K | Yes| Key removed.| | key | K | Yes| Key removed.|
| value | V | Yes| Value removed.| | value | V | Yes| Value removed.|
| newValue | V | No| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.| | newValue | V | No| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.|
**Example** **Example**
``` ```js
var arr = []; var arr = [];
class ChildLruBuffer extends util.LruBuffer class ChildLruBuffer extends util.LruBuffer
{ {
...@@ -984,17 +985,17 @@ Checks whether this buffer contains the specified key. ...@@ -984,17 +985,17 @@ Checks whether this buffer contains the specified key.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key to check.| | key | K | Yes| Key to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.| | boolean | Returns **true** if the buffer contains the specified key; returns **false** otherwise.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.contains(20); var result = pro.contains(20);
...@@ -1010,17 +1011,17 @@ Creates a value if the value of the specified key is not available. ...@@ -1010,17 +1011,17 @@ Creates a value if the value of the specified key is not available.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | Yes| Key of which the value is missing.| | key | K | Yes| Key of which the value is missing.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| V | Value of the key.| | V | Value of the key.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.createDefault(50); var result = pro.createDefault(50);
``` ```
...@@ -1035,12 +1036,12 @@ Obtains a new iterator object that contains all key-value pairs in this object. ...@@ -1035,12 +1036,12 @@ Obtains a new iterator object that contains all key-value pairs in this object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Iterable array.| | [K,&nbsp;V] | Iterable array.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.entries(); var result = pro.entries();
...@@ -1056,12 +1057,12 @@ Obtains a two-dimensional array in key-value pairs. ...@@ -1056,12 +1057,12 @@ Obtains a two-dimensional array in key-value pairs.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | Two-dimensional array in key-value pairs.| | [K,&nbsp;V] | Two-dimensional array in key-value pairs.|
**Example** **Example**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro[symbol.iterator](); var result = pro[symbol.iterator]();
...@@ -1076,7 +1077,7 @@ Obtains a two-dimensional array in key-value pairs. ...@@ -1076,7 +1077,7 @@ Obtains a two-dimensional array in key-value pairs.
Defines the type of values in a **Scope** object. The value type can be **ScopeComparable** or **number**. Defines the type of values in a **Scope** object. The value type can be **ScopeComparable** or **number**.
The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable. The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable.
``` ```js
interface ScopeComparable{ interface ScopeComparable{
compareTo(other: ScopeComparable): boolean; compareTo(other: ScopeComparable): boolean;
} }
...@@ -1088,7 +1089,7 @@ Create a class to implement the **compareTo** method. In the subsequent sample c ...@@ -1088,7 +1089,7 @@ Create a class to implement the **compareTo** method. In the subsequent sample c
Example Example
``` ```js
class Temperature{ class Temperature{
constructor(value){ constructor(value){
this._temp = value; this._temp = value;
...@@ -1115,13 +1116,13 @@ A constructor used to create a **Scope** object with the specified upper and low ...@@ -1115,13 +1116,13 @@ A constructor used to create a **Scope** object with the specified upper and low
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit of the **Scope** object.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit of the **Scope** object.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1137,12 +1138,12 @@ Obtains a string representation that contains this **Scope**. ...@@ -1137,12 +1138,12 @@ Obtains a string representation that contains this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String representation containing the **Scope**.| | string | String representation containing the **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1159,17 +1160,17 @@ Obtains the intersection of this **Scope** and the given **Scope**. ...@@ -1159,17 +1160,17 @@ Obtains the intersection of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.| | [Scope](#scope8) | Intersection of this **Scope** and the given **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1189,18 +1190,18 @@ Obtains the intersection of this **Scope** and the given lower and upper limits. ...@@ -1189,18 +1190,18 @@ Obtains the intersection of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.| | [Scope](#scope8) | Intersection of this **Scope** and the given lower and upper limits.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1220,12 +1221,12 @@ Obtains the upper limit of this **Scope**. ...@@ -1220,12 +1221,12 @@ Obtains the upper limit of this **Scope**.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Upper limit of this **Scope**.| | [ScopeType](#scopetype8) | Upper limit of this **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1242,12 +1243,12 @@ Obtains the lower limit of this **Scope**. ...@@ -1242,12 +1243,12 @@ Obtains the lower limit of this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Lower limit of this **Scope**.| | [ScopeType](#scopetype8) | Lower limit of this **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1264,18 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits. ...@@ -1264,18 +1265,18 @@ Obtains the union set of this **Scope** and the given lower and upper limits.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.| | lowerObj | [ScopeType](#scopetype8) | Yes| Lower limit.|
| upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.| | upperObj | [ScopeType](#scopetype8) | Yes| Upper limit.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.| | [Scope](#scope8) | Union set of this **Scope** and the given lower and upper limits.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1294,17 +1295,17 @@ Obtains the union set of this **Scope** and the given **Scope**. ...@@ -1294,17 +1295,17 @@ Obtains the union set of this **Scope** and the given **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.| | [Scope](#scope8) | Union set of this **Scope** and the given **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1324,17 +1325,17 @@ Obtains the union set of this **Scope** and the given value. ...@@ -1324,17 +1325,17 @@ Obtains the union set of this **Scope** and the given value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | Union set of this **Scope** and the given value.| | [Scope](#scope8) | Union set of this **Scope** and the given value.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1352,17 +1353,17 @@ Checks whether a value is within this **Scope**. ...@@ -1352,17 +1353,17 @@ Checks whether a value is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.| | boolean | Returns **true** if the value is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1380,17 +1381,17 @@ Checks whether a range is within this **Scope**. ...@@ -1380,17 +1381,17 @@ Checks whether a range is within this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | Yes| **Scope** specified.| | range | [Scope](#scope8) | Yes| **Scope** specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.| | boolean | Returns **true** if the range is within this **Scope**; returns **false** otherwise.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1410,17 +1411,17 @@ Limits a value to this **Scope**. ...@@ -1410,17 +1411,17 @@ Limits a value to this **Scope**.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | Yes| Value specified.| | value | [ScopeType](#scopetype8) | Yes| Value specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**.| | [ScopeType](#scopetype8) | Returns **lowerObj** if the specified value is less than the lower limit; returns **upperObj** if the specified value is greater than the upper limit; returns the specified value if it is within this **Scope**.|
**Example** **Example**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1441,7 +1442,7 @@ A constructor used to create a **Base64** object. ...@@ -1441,7 +1442,7 @@ A constructor used to create a **Base64** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var base64 = new util.Base64(); var base64 = new util.Base64();
``` ```
...@@ -1455,17 +1456,17 @@ Encodes the input content. ...@@ -1455,17 +1456,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode.| | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array encoded.| | Uint8Array | Uint8Array encoded.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeSync(array); var result = that.encodeSync(array);
...@@ -1481,17 +1482,17 @@ Encodes the input content. ...@@ -1481,17 +1482,17 @@ Encodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode.| | src | Uint8Array | Yes| Uint8Array to encode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | String encoded from the Uint8Array.| | string | String encoded from the Uint8Array.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeToStringSync(array); var result = that.encodeToStringSync(array);
...@@ -1507,17 +1508,17 @@ Decodes the input content. ...@@ -1507,17 +1508,17 @@ Decodes the input content.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode.| | src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Uint8Array decoded.| | Uint8Array | Uint8Array decoded.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var buff = 'czEz'; var buff = 'czEz';
var result = that.decodeSync(buff); var result = that.decodeSync(buff);
...@@ -1533,17 +1534,17 @@ Encodes the input content asynchronously. ...@@ -1533,17 +1534,17 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding.| | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous encoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
...@@ -1564,17 +1565,17 @@ Encodes the input content asynchronously. ...@@ -1564,17 +1565,17 @@ Encodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | Yes| Uint8Array to encode asynchronously.| | src | Uint8Array | Yes| Uint8Array to encode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | String obtained after asynchronous encoding.| | Promise&lt;string&gt; | String obtained after asynchronous encoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
...@@ -1592,17 +1593,17 @@ Decodes the input content asynchronously. ...@@ -1592,17 +1593,17 @@ Decodes the input content asynchronously.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode asynchronously.| | src | Uint8Array&nbsp;\|&nbsp;string | Yes| Uint8Array or string to decode asynchronously.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding.| | Promise&lt;Uint8Array&gt; | Uint8Array obtained after asynchronous decoding.|
**Example** **Example**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]); var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
...@@ -1626,7 +1627,7 @@ A constructor used to create a **types** object. ...@@ -1626,7 +1627,7 @@ A constructor used to create a **types** object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Example** **Example**
``` ```js
var type = new util.types(); var type = new util.types();
``` ```
...@@ -1640,17 +1641,17 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1640,17 +1641,17 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAnyArrayBuffer(new ArrayBuffer([])); var result = that.isAnyArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1667,17 +1668,17 @@ Checks whether the input value is of the **ArrayBufferView** type. ...@@ -1667,17 +1668,17 @@ Checks whether the input value is of the **ArrayBufferView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBufferView** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBufferView(new Int8Array([])); var result = that.isArrayBufferView(new Int8Array([]));
``` ```
...@@ -1692,17 +1693,17 @@ Checks whether the input value is of the **arguments** type. ...@@ -1692,17 +1693,17 @@ Checks whether the input value is of the **arguments** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **arguments** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
function foo() { function foo() {
var result = that.isArgumentsObject(arguments); var result = that.isArgumentsObject(arguments);
...@@ -1720,17 +1721,17 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1720,17 +1721,17 @@ Checks whether the input value is of the **ArrayBuffer** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **ArrayBuffer** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isArrayBuffer(new ArrayBuffer([])); var result = that.isArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1745,17 +1746,17 @@ Checks whether the input value is an asynchronous function. ...@@ -1745,17 +1746,17 @@ Checks whether the input value is an asynchronous function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.| | boolean | Returns **true** if the input value is an asynchronous function; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isAsyncFunction(async function foo() {}); var result = that.isAsyncFunction(async function foo() {});
``` ```
...@@ -1770,17 +1771,17 @@ Checks whether the input value is of the **Boolean** type. ...@@ -1770,17 +1771,17 @@ Checks whether the input value is of the **Boolean** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Boolean** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBooleanObject(new Boolean(true)); var result = that.isBooleanObject(new Boolean(true));
``` ```
...@@ -1795,17 +1796,17 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or ...@@ -1795,17 +1796,17 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isBoxedPrimitive(new Boolean(false)); var result = that.isBoxedPrimitive(new Boolean(false));
``` ```
...@@ -1820,17 +1821,17 @@ Checks whether the input value is of the **DataView** type. ...@@ -1820,17 +1821,17 @@ Checks whether the input value is of the **DataView** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **DataView** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const ab = new ArrayBuffer(20); const ab = new ArrayBuffer(20);
var result = that.isDataView(new DataView(ab)); var result = that.isDataView(new DataView(ab));
...@@ -1846,17 +1847,17 @@ Checks whether the input value is of the **Date** type. ...@@ -1846,17 +1847,17 @@ Checks whether the input value is of the **Date** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Date** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isDate(new Date()); var result = that.isDate(new Date());
``` ```
...@@ -1871,17 +1872,17 @@ Checks whether the input value is of the **native external** type. ...@@ -1871,17 +1872,17 @@ Checks whether the input value is of the **native external** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **native external** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const data = util.createExternalType(); const data = util.createExternalType();
var result = that.isExternal(data); var result = that.isExternal(data);
...@@ -1897,17 +1898,17 @@ Checks whether the input value is of the **Float32Array** type. ...@@ -1897,17 +1898,17 @@ Checks whether the input value is of the **Float32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Float32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat32Array(new Float32Array()); var result = that.isFloat32Array(new Float32Array());
``` ```
...@@ -1922,17 +1923,17 @@ Checks whether the input value is of the **Float64Array** type. ...@@ -1922,17 +1923,17 @@ Checks whether the input value is of the **Float64Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Float64Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isFloat64Array(new Float64Array()); var result = that.isFloat64Array(new Float64Array());
``` ```
...@@ -1947,17 +1948,17 @@ Checks whether the input value is a generator function. ...@@ -1947,17 +1948,17 @@ Checks whether the input value is a generator function.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.| | boolean | Returns **true** if the input value is a generator function; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isGeneratorFunction(function* foo() {}); var result = that.isGeneratorFunction(function* foo() {});
``` ```
...@@ -1972,17 +1973,17 @@ Checks whether the input value is a generator object. ...@@ -1972,17 +1973,17 @@ Checks whether the input value is a generator object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a generator object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
function* foo() {} function* foo() {}
const generator = foo(); const generator = foo();
...@@ -1999,17 +2000,17 @@ Checks whether the input value is of the **Int8Array** type. ...@@ -1999,17 +2000,17 @@ Checks whether the input value is of the **Int8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int8Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt8Array(new Int8Array([])); var result = that.isInt8Array(new Int8Array([]));
``` ```
...@@ -2024,17 +2025,17 @@ Checks whether the input value is of the **Int16Array** type. ...@@ -2024,17 +2025,17 @@ Checks whether the input value is of the **Int16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int16Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt16Array(new Int16Array([])); var result = that.isInt16Array(new Int16Array([]));
``` ```
...@@ -2049,17 +2050,17 @@ Checks whether the input value is of the **Int32Array** type. ...@@ -2049,17 +2050,17 @@ Checks whether the input value is of the **Int32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Int32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isInt32Array(new Int32Array([])); var result = that.isInt32Array(new Int32Array([]));
``` ```
...@@ -2074,17 +2075,17 @@ Checks whether the input value is of the **Map** type. ...@@ -2074,17 +2075,17 @@ Checks whether the input value is of the **Map** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Map** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isMap(new Map()); var result = that.isMap(new Map());
``` ```
...@@ -2099,17 +2100,17 @@ Checks whether the input value is of the **MapIterator** type. ...@@ -2099,17 +2100,17 @@ Checks whether the input value is of the **MapIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **MapIterator** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const map = new Map(); const map = new Map();
var result = that.isMapIterator(map.keys()); var result = that.isMapIterator(map.keys());
...@@ -2125,17 +2126,17 @@ Checks whether the input value is of the **Error** type. ...@@ -2125,17 +2126,17 @@ Checks whether the input value is of the **Error** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Error** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNativeError(new TypeError()); var result = that.isNativeError(new TypeError());
``` ```
...@@ -2150,17 +2151,17 @@ Checks whether the input value is a number object. ...@@ -2150,17 +2151,17 @@ Checks whether the input value is a number object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a number object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a number object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isNumberObject(new Number(0)); var result = that.isNumberObject(new Number(0));
``` ```
...@@ -2175,17 +2176,17 @@ Checks whether the input value is a promise. ...@@ -2175,17 +2176,17 @@ Checks whether the input value is a promise.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a promise; returns **false** otherwise.| | boolean | Returns **true** if the input value is a promise; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isPromise(Promise.resolve(1)); var result = that.isPromise(Promise.resolve(1));
``` ```
...@@ -2200,17 +2201,17 @@ Checks whether the input value is a proxy. ...@@ -2200,17 +2201,17 @@ Checks whether the input value is a proxy.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.| | boolean | Returns **true** if the input value is a proxy; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const target = {}; const target = {};
const proxy = new Proxy(target, {}); const proxy = new Proxy(target, {});
...@@ -2227,17 +2228,17 @@ Checks whether the input value is of the **RegExp** type. ...@@ -2227,17 +2228,17 @@ Checks whether the input value is of the **RegExp** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **RegExp** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isRegExp(new RegExp('abc')); var result = that.isRegExp(new RegExp('abc'));
``` ```
...@@ -2252,17 +2253,17 @@ Checks whether the input value is of the **Set** type. ...@@ -2252,17 +2253,17 @@ Checks whether the input value is of the **Set** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Set** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isSet(new Set()); var result = that.isSet(new Set());
``` ```
...@@ -2277,17 +2278,17 @@ Checks whether the input value is of the **SetIterator** type. ...@@ -2277,17 +2278,17 @@ Checks whether the input value is of the **SetIterator** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **SetIterator** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const set = new Set(); const set = new Set();
var result = that.isSetIterator(set.keys()); var result = that.isSetIterator(set.keys());
...@@ -2303,17 +2304,17 @@ Checks whether the input value is a string object. ...@@ -2303,17 +2304,17 @@ Checks whether the input value is a string object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a string object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a string object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isStringObject(new String('foo')); var result = that.isStringObject(new String('foo'));
``` ```
...@@ -2328,17 +2329,17 @@ Checks whether the input value is a symbol object. ...@@ -2328,17 +2329,17 @@ Checks whether the input value is a symbol object.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.| | boolean | Returns **true** if the input value is a symbol object; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
const symbols = Symbol('foo'); const symbols = Symbol('foo');
var result = that.isSymbolObject(Object(symbols)); var result = that.isSymbolObject(Object(symbols));
...@@ -2356,17 +2357,17 @@ Checks whether the input value is of the **TypedArray** type. ...@@ -2356,17 +2357,17 @@ Checks whether the input value is of the **TypedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **TypedArray** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isTypedArray(new Float64Array([])); var result = that.isTypedArray(new Float64Array([]));
``` ```
...@@ -2381,17 +2382,17 @@ Checks whether the input value is of the **Uint8Array** type. ...@@ -2381,17 +2382,17 @@ Checks whether the input value is of the **Uint8Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint8Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8Array(new Uint8Array([])); var result = that.isUint8Array(new Uint8Array([]));
``` ```
...@@ -2406,17 +2407,17 @@ Checks whether the input value is of the **Uint8ClampedArray** type. ...@@ -2406,17 +2407,17 @@ Checks whether the input value is of the **Uint8ClampedArray** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint8ClampedArray** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint8ClampedArray(new Uint8ClampedArray([])); var result = that.isUint8ClampedArray(new Uint8ClampedArray([]));
``` ```
...@@ -2431,17 +2432,17 @@ Checks whether the input value is of the **Uint16Array** type. ...@@ -2431,17 +2432,17 @@ Checks whether the input value is of the **Uint16Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint16Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint16Array(new Uint16Array([])); var result = that.isUint16Array(new Uint16Array([]));
``` ```
...@@ -2456,17 +2457,17 @@ Checks whether the input value is of the **Uint32Array** type. ...@@ -2456,17 +2457,17 @@ Checks whether the input value is of the **Uint32Array** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **Uint32Array** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isUint32Array(new Uint32Array([])); var result = that.isUint32Array(new Uint32Array([]));
``` ```
...@@ -2481,17 +2482,17 @@ Checks whether the input value is of the **WeakMap** type. ...@@ -2481,17 +2482,17 @@ Checks whether the input value is of the **WeakMap** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **WeakMap** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakMap(new WeakMap()); var result = that.isWeakMap(new WeakMap());
``` ```
...@@ -2506,17 +2507,17 @@ Checks whether the input value is of the **WeakSet** type. ...@@ -2506,17 +2507,17 @@ Checks whether the input value is of the **WeakSet** type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | Yes| Object to check.| | value | Object | Yes| Object to check.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.| | boolean | Returns **true** if the input value is of the **WeakSet** type; returns **false** otherwise.|
**Example** **Example**
``` ```js
var that = new util.types(); var that = new util.types();
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance. ...@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -54,7 +54,7 @@ Sets an attribute. ...@@ -54,7 +54,7 @@ Sets an attribute.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -74,8 +74,8 @@ Adds an empty element. ...@@ -74,8 +74,8 @@ Adds an empty element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ Sets a declaration. ...@@ -88,7 +88,7 @@ Sets a declaration.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name. ...@@ -108,7 +108,7 @@ Writes the start tag based on the given element name.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ Writes the end tag of the element. ...@@ -124,7 +124,7 @@ Writes the end tag of the element.
**Example** **Example**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
...@@ -149,7 +149,7 @@ Sets the namespace for an element tag. ...@@ -149,7 +149,7 @@ Sets the namespace for an element tag.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -172,7 +172,7 @@ Sets the comment. ...@@ -172,7 +172,7 @@ Sets the comment.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -195,7 +195,7 @@ Sets CDATA attributes. ...@@ -195,7 +195,7 @@ Sets CDATA attributes.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -216,7 +216,7 @@ Sets **Text**. ...@@ -216,7 +216,7 @@ Sets **Text**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -240,7 +240,7 @@ Sets **DocType**. ...@@ -240,7 +240,7 @@ Sets **DocType**.
**Example** **Example**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa ...@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Example** **Example**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -297,7 +297,7 @@ Parses XML information. ...@@ -297,7 +297,7 @@ Parses XML information.
**Example** **Example**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
...@@ -29,7 +29,7 @@ Touch target configuration is not supported. ...@@ -29,7 +29,7 @@ Touch target configuration is not supported.
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| tabBar | string \| {<br/>icon?: string,<br/>text?: string<br/>}<br/>\|[CustomBuilder](../../ui/ts-types.md) | - | Content displayed on the tab bar.<br/>**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. | | tabBar | string \| {<br/>icon?: string,<br/>text?: string<br/>}<br/>\| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Content displayed on the tab bar.<br/>**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).<br/>> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>> If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The **&lt;TabContent&gt;** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **&lt;Tabs&gt;** component. > - The **&lt;TabContent&gt;** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **&lt;Tabs&gt;** component.
......
...@@ -11,7 +11,7 @@ You can create a button by invoking either of the following APIs: ...@@ -11,7 +11,7 @@ You can create a button by invoking either of the following APIs:
- Button(options?: {type?: ButtonType, stateEffect?: boolean}) - Button(options?: {type?: ButtonType, stateEffect?: boolean})
This API creates a button that contains child components. In the syntax, **type** indicates the button type, and **stateEffect** indicates whether to enable the click effect for the button. This API creates a button that contains child components. In the syntax, **type** indicates the button type, and **stateEffect** indicates whether to enable the click effect for the button.
``` ```
Button({ type: ButtonType.Normal, stateEffect: true }) { Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() { Row() {
...@@ -26,7 +26,7 @@ You can create a button by invoking either of the following APIs: ...@@ -26,7 +26,7 @@ You can create a button by invoking either of the following APIs:
- Button(label?: string, options?: { type?: ButtonType, stateEffect?: boolean }) - Button(label?: string, options?: { type?: ButtonType, stateEffect?: boolean })
This API creates a button that does not contain any child components. In the syntax, **label** indicates whether the created button contains child components. This API creates a button that does not contain any child components. In the syntax, **label** indicates whether the created button contains child components.
``` ```
Button('Ok', { type: ButtonType.Normal, stateEffect: true }) Button('Ok', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8) .borderRadius(8)
...@@ -42,7 +42,7 @@ You can create a button by invoking either of the following APIs: ...@@ -42,7 +42,7 @@ You can create a button by invoking either of the following APIs:
Use the **type** parameter to set the button type to **Capsule**, **Circle**, or **Normal**. Use the **type** parameter to set the button type to **Capsule**, **Circle**, or **Normal**.
- Capsule button (default type) - Capsule button (default type)
``` ```
Button('Disable', { type: ButtonType.Capsule, stateEffect: false }) Button('Disable', { type: ButtonType.Capsule, stateEffect: false })
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
...@@ -52,7 +52,7 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -52,7 +52,7 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
![en-us_image_0000001215645452](figures/en-us_image_0000001215645452.png) ![en-us_image_0000001215645452](figures/en-us_image_0000001215645452.png)
- Circle button - Circle button
``` ```
Button('Circle', { type: ButtonType.Circle, stateEffect: false }) Button('Circle', { type: ButtonType.Circle, stateEffect: false })
.backgroundColor(0x317aff) .backgroundColor(0x317aff)
...@@ -68,18 +68,18 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -68,18 +68,18 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
- Set the border radius: - Set the border radius:
In general cases, you can use universal attributes to define the button styles. For example, you can use the **borderRadius** attribute to set the border radius. In general cases, you can use universal attributes to define the button styles. For example, you can use the **borderRadius** attribute to set the border radius.
``` ```
Button('circle border', { type: ButtonType.Normal }) Button('circle border', { type: ButtonType.Normal })
.borderRadius(20) .borderRadius(20)
``` ```
![zh-cn_image_0000001190463780](figures/zh-cn_image_0000001190463780.png) ![en-us_image_0000001215645452](figures/en-us_image_0000001215645452.png)
- Setting Text Styles - Setting Text Styles
Add a font style for text displayed on the button. Add a font style for text displayed on the button.
``` ```
Button('font style', { type: ButtonType.Normal }) Button('font style', { type: ButtonType.Normal })
.fontSize(20) .fontSize(20)
...@@ -87,12 +87,12 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -87,12 +87,12 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
.fontWeight(800) .fontWeight(800)
``` ```
![zh-cn_image_0000001189744672](figures/zh-cn_image_0000001189744672.png) ![en-us_image_0000001215965420](figures/en-us_image_0000001215965420.png)
- Set the background color: - Set the background color:
You can do so by adding the **backgroundColor** attribute. You can do so by adding the **backgroundColor** attribute.
``` ```
Button('background color').backgroundColor(0xF55A42) Button('background color').backgroundColor(0xF55A42)
``` ```
...@@ -102,7 +102,7 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or ...@@ -102,7 +102,7 @@ Use the **type** parameter to set the button type to **Capsule**, **Circle**, or
- Assign a function to the button: - Assign a function to the button:
In this example, we are creating a button with the delete function. In this example, we are creating a button with the delete function.
``` ```
Button({ type: ButtonType.Circle, stateEffect: true }) { Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r('app.media.ic_public_delete_filled')).width(30).height(30) Image($r('app.media.ic_public_delete_filled')).width(30).height(30)
...@@ -133,7 +133,7 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -133,7 +133,7 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
``` ```
import router from '@ohos.router' import router from '@ohos.router'
@Entry @Entry
@Component @Component
struct ButtonCase1 { struct ButtonCase1 {
...@@ -144,13 +144,13 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -144,13 +144,13 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
router.push({ url: 'xxx' }) router.push({ url: 'xxx' })
}) })
} }
ListItem() { ListItem() {
Button("Second").onClick(() => { Button("Second").onClick(() => {
router.push({ url: 'yyy' }) router.push({ url: 'yyy' })
}) })
} }
ListItem() { ListItem() {
Button("Third").onClick(() => { Button("Third").onClick(() => {
router.push({ url: 'zzz' }) router.push({ url: 'zzz' })
...@@ -170,7 +170,7 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -170,7 +170,7 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
- Using the Button for Submitting Forms - Using the Button for Submitting Forms
On the user login/registration page, you can use a button to submit a login or registration request. On the user login/registration page, you can use a button to submit a login or registration request.
``` ```
@Entry @Entry
@Component @Component
...@@ -184,5 +184,5 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true }) ...@@ -184,5 +184,5 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
} }
} }
``` ```
![en-us_image_0000001190466492](figures/en-us_image_0000001190466492.png) ![en-us_image_0000001190466492](figures/en-us_image_0000001190466492.png)
...@@ -45,9 +45,9 @@ screen and (device-type: tv) or (resolution &lt; 2) // This is a multi-condition ...@@ -45,9 +45,9 @@ screen and (device-type: tv) or (resolution &lt; 2) // This is a multi-condition
### media-type ### media-type
| Type| Description| | Type | Description |
| -------- | -------- | | ------ | ---------------------------------------- |
| screen | Media query based on screen-related parameters.| | screen | Media query based on screen-related parameters. |
### Media Logic Operation (and|not|only) ### Media Logic Operation (and|not|only)
...@@ -56,48 +56,48 @@ You can use logical operators (**and**, **or**, **not**, and **only**) to compos ...@@ -56,48 +56,48 @@ You can use logical operators (**and**, **or**, **not**, and **only**) to compos
**Table 1** Media logical operators **Table 1** Media logical operators
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | ---------------------------------------- |
| and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.<br>For example, **screen&nbsp;and&nbsp;(device-type:&nbsp;wearable)&nbsp;and&nbsp;(max-height:&nbsp;600)&nbsp;** indicates that the query is valid when the device type is wearable and the maximum height of the application is 600 pixel units.| | and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.<br>For example, **screen&nbsp;and&nbsp;(device-type:&nbsp;wearable)&nbsp;and&nbsp;(max-height:&nbsp;600)&nbsp;** indicates that the query is valid when the device type is wearable and the maximum height of the application is 600 pixel units. |
| not | The **not** operator is used to perform a logical negation for a media query. **true** is returned if the query condition is not met. Otherwise, **false** is returned. In a media query list, logical negation is performed only for the media query using the **not** operator.<br>For example, **not&nbsp;screen&nbsp;and&nbsp;(min-height:&nbsp;50)&nbsp;and&nbsp;(max-height:&nbsp;600)&nbsp;** indicates that the query is valid when the height of the application is less than 50 pixel units or greater than 600 pixel units.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;When the **not** operator is used, the media type must be specified.| | not | The **not** operator is used to perform a logical negation for a media query. **true** is returned if the query condition is not met. Otherwise, **false** is returned. In a media query list, logical negation is performed only for the media query using the **not** operator.<br>For example, **not&nbsp;screen&nbsp;and&nbsp;(min-height:&nbsp;50)&nbsp;and&nbsp;(max-height:&nbsp;600)&nbsp;** indicates that the query is valid when the height of the application is less than 50 pixel units or greater than 600 pixel units.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;When the **not** operator is used, the media type must be specified. |
| only | The **only** operator applies the selected style only when the entire expression is matched. It can be used to prevent ambiguity on browsers of earlier versions. The statements that contain both media types and media features produce ambiguity when they are received by some browsers of earlier versions. For example:<br>screen&nbsp;and&nbsp;(min-height:&nbsp;50)<br>The browsers of earlier versions would mislead this sentence into screen, causing the fact that the specified style is applied when only the media type is matched. In this case, the **only** operator can be used to avoid this problem.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;When the **only** operator is used, the media type must be specified.| | only | The **only** operator applies the selected style only when the entire expression is matched. It can be used to prevent ambiguity on browsers of earlier versions. The statements that contain both media types and media features produce ambiguity when they are received by some browsers of earlier versions. For example:<br>screen&nbsp;and&nbsp;(min-height:&nbsp;50)<br>The browsers of earlier versions would mislead this sentence into screen, causing the fact that the specified style is applied when only the media type is matched. In this case, the **only** operator can be used to avoid this problem.<br>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**NOTE**<br>>&nbsp;When the **only** operator is used, the media type must be specified. |
| ,(comma) | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true. The effect of a comma operator is equivalent to that of the **or** operator.<br>For example, **screen&nbsp;and&nbsp;(min-height:&nbsp;1000),&nbsp;&nbsp;(round-screen: true)&nbsp;** indicates that the query is valid when the minimum height of the application is 1000 pixel units or the device screen is round.| | ,(comma) | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true. The effect of a comma operator is equivalent to that of the **or** operator.<br>For example, **screen&nbsp;and&nbsp;(min-height:&nbsp;1000),&nbsp;&nbsp;(round-screen: true)&nbsp;** indicates that the query is valid when the minimum height of the application is 1000 pixel units or the device screen is round. |
| or | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.<br>For example, **screen&nbsp;and&nbsp;(max-height:&nbsp;1000)&nbsp;or&nbsp;&nbsp;(round-screen: true)** indicates that the query is valid when the maximum height of the application is 1000 pixel units or the device screen is round.| | or | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.<br>For example, **screen&nbsp;and&nbsp;(max-height:&nbsp;1000)&nbsp;or&nbsp;&nbsp;(round-screen: true)** indicates that the query is valid when the maximum height of the application is 1000 pixel units or the device screen is round. |
At MediaQuery Level 4, range query is imported so that you can use the operators including &lt;=, &gt;=, &lt;, and &gt; besides the **max-** and **min-** operators. At MediaQuery Level 4, range query is imported so that you can use the operators including &lt;=, &gt;=, &lt;, and &gt; besides the **max-** and **min-** operators.
**Table 2** Logical operators for range query **Table 2** Logical operators for range query
| Type| Description| | Type | Description |
| -------- | -------- | | ----- | ---------------------------------------- |
| &lt;= | Less than or equal to, for example, **screen&nbsp;and&nbsp;(50&nbsp;&lt;=&nbsp;height)**.| | &lt;= | Less than or equal to, for example, **screen&nbsp;and&nbsp;(50&nbsp;&lt;=&nbsp;height)**. |
| &gt;= | Greater than or equal to, for example, **screen&nbsp;and&nbsp;(600&nbsp;&gt;=&nbsp;height)**.| | &gt;= | Greater than or equal to, for example, **screen&nbsp;and&nbsp;(600&nbsp;&gt;=&nbsp;height)**. |
| &lt; | Less than, for example, **screen&nbsp;and&nbsp;(50&nbsp;&lt;&nbsp;height)**.| | &lt; | Less than, for example, **screen&nbsp;and&nbsp;(50&nbsp;&lt;&nbsp;height)**. |
| &gt; | Greater than, for example, **screen&nbsp;and&nbsp;(600&nbsp;&gt;&nbsp;height)**.| | &gt; | Greater than, for example, **screen&nbsp;and&nbsp;(600&nbsp;&gt;&nbsp;height)**. |
### media-feature ### media-feature
| Type| Description| | Type | Description |
| -------- | -------- | | ----------------- | ---------------------------------------- |
| height | Height of the display area on the application page.| | height | Height of the display area on the application page. |
| min-height | Minimum height of the display area on the application page.| | min-height | Minimum height of the display area on the application page. |
| max-height | Maximum height of the display area on the application page.| | max-height | Maximum height of the display area on the application page. |
| width | Width of the display area on the app page.| | width | Width of the display area on the app page. |
| min-width | Minimum width of the display area on the application page.| | min-width | Minimum width of the display area on the application page. |
| max-width | Maximum width of the display area on the application page.| | max-width | Maximum width of the display area on the application page. |
| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.<br>-&nbsp;**dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.<br>-&nbsp;**dpcm** indicates the number of physical pixels per centimeter. 1 dpcm&nbsp;&nbsp;2.54 dpi.<br>-&nbsp;**dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx&nbsp;=&nbsp;96 dpi.| | resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.<br>-&nbsp;**dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.<br>-&nbsp;**dpcm** indicates the number of physical pixels per centimeter. 1 dpcm&nbsp;&nbsp;2.54 dpi.<br>-&nbsp;**dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx&nbsp;=&nbsp;96 dpi. |
| min-resolution | Minimum device resolution.| | min-resolution | Minimum device resolution. |
| max-resolution | Maximum device resolution.| | max-resolution | Maximum device resolution. |
| orientation | Screen orientation.<br>Options are as follows:<br>-&nbsp;orientation:&nbsp;portrait<br>-&nbsp;orientation:&nbsp;landscape| | orientation | Screen orientation.<br>Options are as follows:<br>-&nbsp;orientation:&nbsp;portrait<br>-&nbsp;orientation:&nbsp;landscape |
| device-height | Height of the device.| | device-height | Height of the device. |
| min-device-height | Minimum height of the device.| | min-device-height | Minimum height of the device. |
| max-device-height | Maximum height of the device.| | max-device-height | Maximum height of the device. |
| device-width | Width of the device.| | device-width | Width of the device. |
| min-device-width | Minimum width of the device.| | min-device-width | Minimum width of the device. |
| max-device-width | Maximum width of the device.| | max-device-width | Maximum width of the device. |
| round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite.| | round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. |
| dark-mode | Whether the device is in dark mode. The value **true** means that the device is in dark mode, and **false** means the opposite.| | dark-mode | Whether the device is in dark mode. The value **true** means that the device is in dark mode, and **false** means the opposite. |
## Example Scenario ## Example Scenario
...@@ -139,7 +139,7 @@ Use media queries to apply different content and styles to the page text when th ...@@ -139,7 +139,7 @@ Use media queries to apply different content and styles to the page text when th
} }
``` ```
When the device is in landscape orientation, the text content is displayed in landscape mode in the color of #FFD700.<br/> When the device is in landscape orientation, the text content is displayed in landscape mode in the color of #FFD700.<br/>
![zh-cn_image_0000001262954829](figures/zh-cn_image_0000001262954829.png) ![en-us_image_0000001262954829](figures/en-us_image_0000001262954829.png)
When the device is not in landscape orientation, the text content is displayed in portrait mode in the color of #DB7093.<br/> When the device is not in landscape orientation, the text content is displayed in portrait mode in the color of #DB7093.<br/>
![en-us_image_0000001263074739](figures/en-us_image_0000001263074739.png) ![en-us_image_0000001263074739](figures/en-us_image_0000001263074739.png)
...@@ -556,7 +556,7 @@ ...@@ -556,7 +556,7 @@
- [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md) - [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md) - [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md)
- [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md) - [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md)
- [@ohos.data.storage](reference/apis/js-apis-data-storage.md) - [@ohos.data.storage](reference/apis/js-apis-data-storage.md)
- [@ohos.settings](reference/apis/js-apis-settings.md) - [@ohos.settings](reference/apis/js-apis-settings.md)
- [resultSet](reference/apis/js-apis-data-resultset.md) - [resultSet](reference/apis/js-apis-data-resultset.md)
......
# Use Case<a name="EN-US_TOPIC_0000001055686082"></a> # Use Case<a name="EN-US_TOPIC_0000001055686082"></a>
- For details about the development board, compilation, burning, and image running, see [Hi3518 Development Board](../quick-start/quickstart-lite-introduction-hi3518.md#section14815247616). A compilation result file of sample code is stored in **out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample**. You can copy the file to a TF card, or modify the compilation script of **camera\_sample** to copy the result to **rootfs.img**. - A Hi318 compilation result file of sample code is stored in **out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample**. You can copy the file to a TF card, or modify the compilation script of **camera\_sample** to copy the result to **rootfs.img**.
Modify **output\_dir** in **applications/sample/camera/media/BUILD.gn**. Modify **output\_dir** in **applications/sample/camera/media/BUILD.gn**.
......
...@@ -97,7 +97,7 @@ Based on the Hi3861 platform, the OpenHarmony WLAN module provides abundant peri ...@@ -97,7 +97,7 @@ Based on the Hi3861 platform, the OpenHarmony WLAN module provides abundant peri
## Verification<a name="section1949121910344"></a> ## Verification<a name="section1949121910344"></a>
For details about the compilation and burning processes, see [Building Source Code](../quick-start/quickstart-lite-steps-hi3861-connection.md#section191121332125319) and [Burning Images](../quick-start/quickstart-lite-steps-hi3861-connection.md#section3288165814218) in the _Getting Started with Hi3861_. For details about the compilation and burning processes, see [Building Source Code](../quick-start/quickstart-ide-lite-steps-hi3861-building.md) and [Burning Images](../quick-start/quickstart-ide-lite-steps-hi3861-burn.md) in the _Getting Started with Hi3861_.
After the preceding two steps are complete, press the **RST** button to reset the module. If the LED blinks periodically as expected, the verification is passed. After the preceding two steps are complete, press the **RST** button to reset the module. If the LED blinks periodically as expected, the verification is passed.
......
...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge ...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge
- Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool.
OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode.
This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Mini and Small Systems (Installation Package Mode)](../quick-start/quickstart-lite-package-directory.md). This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Mini and Small Systems (Installation Package Mode)](../quick-start/quickstart-lite-overview.md).
## Development Environment ## Development Environment
...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ
## Development Boards ## Development Boards
In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-ide-lite-board-introduction.md). You can purchase the development board as required. In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-ide-lite-introduction-hi3861.md). You can purchase the development board as required.
## Development Process ## Development Process
......
...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge ...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge
- Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool.
OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode.
This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Standard System (Installation Package Mode)](../quick-start/quickstart-standard-package-directory.md). This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Standard System (Installation Package Mode)](../quick-start/quickstart-standard-overview.md).
## Development Environment ## Development Environment
...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ
## Development Boards ## Development Boards
In this document, two development board models are used as examples: Hi3516D V300 and RK3568. For details about these development boards, see [Appendix](../quick-start/quickstart-standard-board-introduction.md). You can purchase the development board as required. In this document, two development board models are used as examples: Hi3516D V300 and RK3568. For details about these development boards, see [Appendix](../quick-start/quickstart-ide-standard-board-introduction-hi3516.md). You can purchase the development board as required.
## Development Process ## Development Process
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
Error: Opening COMxx: Access denied is displayed after clicking Burn and selecting a serial port. Error: Opening COMxx: Access denied is displayed after clicking Burn and selecting a serial port.
**Figure 1** Failed to open the serial port **Figure 1** Failed to open the serial port
![en-us_image_0000001226634728](figures/en-us_image_0000001226634728.png) ![en-us_image_0000001226634728](figures/en-us_image_0000001226634728.png)
- **Possible Causes** - **Possible Causes**
...@@ -42,9 +42,9 @@ ...@@ -42,9 +42,9 @@
The file image cannot be obtained after clicking Burn and selecting a serial port. The file image cannot be obtained after clicking Burn and selecting a serial port.
**Figure 5** Failed to obtain the file image due to network disconnection **Figure 5** Failed to obtain the file image due to network disconnection
![en-us_image_0000001271234757](figures/en-us_image_0000001271234757.png) ![en-us_image_0000001271234757](figures/en-us_image_0000001271234757.png)
- **Possible Causes** - **Possible Causes**
...@@ -125,15 +125,12 @@ ...@@ -125,15 +125,12 @@
1. Obtain the U-Boot file. 1. Obtain the U-Boot file.
> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE** > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
> The U-Boot file of the two boards can be obtained from the following paths, respectively. >
> > The U-Boot file can be obtained from the following path: device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin.
> Hi3516D V300: device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin
>
> Hi3518E V300: device\hisilicon\hispark_aries\sdk_liteos\uboot\out\boot\u-boot-hi3518ev300.bin
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB. 2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of corresponding development boards for burning by referring to [Burning to Hi3516D V300](https://device.harmonyos.com/en/docs/documentation/guide/ide-hi3516-upload-0000001052148681)/[Burning to Hi3518E V300](https://device.harmonyos.com/en/docs/documentation/guide/ide-hi3518-upload-0000001057313128#section93591711580). Select the U-Boot files of corresponding development boards for burning by referring to [Burning to Hi3516D V300](https://device.harmonyos.com/en/docs/documentation/guide/ide-hi3516-upload-0000001052148681).
3. Log in to the serial port after the burning is complete. 3. Log in to the serial port after the burning is complete.
......
...@@ -15,7 +15,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge ...@@ -15,7 +15,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge
- Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode.
This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Mini and Small Systems (IDE Mode)](../quick-start/quickstart-lite-ide-directory.md). This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Mini and Small Systems (IDE Mode)](../quick-start/quickstart-ide-lite-overview.md).
## Development Environment ## Development Environment
...@@ -31,7 +31,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ...@@ -31,7 +31,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ
## Development Boards ## Development Boards
In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-lite-board-introduction.md). You can purchase the development board as required. In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-lite-introduction-hi3861.md). You can purchase the development board as required.
## Development Process ## Development Process
......
...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge ...@@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge
- Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool.
OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode.
This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Standard System (IDE Mode)](../quick-start/quickstart-standard-ide-directory.md). This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Standard System (IDE Mode)](../quick-start/quickstart-ide-standard-overview.md).
## Development Environment ## Development Environment
...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ...@@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ
## Development Boards ## Development Boards
In this document, two development board models are used as examples: Hi3516D V300 and RK3516. For details about these development boards, see [Appendix](../quick-start/quickstart-standard-board-introduction.md). You can purchase the development board as required. In this document, two development board models are used as examples: Hi3516D V300 and RK3516. For details about these development boards, see [Appendix](../quick-start/quickstart-standard-board-introduction-hi3516.md). You can purchase the development board as required.
## Development Process ## Development Process
......
...@@ -8,7 +8,7 @@ The following exemplifies how to run the first program on the development board. ...@@ -8,7 +8,7 @@ The following exemplifies how to run the first program on the development board.
The complete code directory is as follows: The complete code directory is as follows:
``` ```
applications/sample/hello applications/sample/hello
│ │── BUILD.gn │ │── BUILD.gn
...@@ -21,7 +21,7 @@ build ...@@ -21,7 +21,7 @@ build
└── subsystem_config.json └── subsystem_config.json
productdefine/common productdefine/common
└── products └── products
└── Hi3568DV300.json └── Hi3516DV300.json
``` ```
...@@ -34,7 +34,7 @@ Perform the steps below in the source code directory: ...@@ -34,7 +34,7 @@ Perform the steps below in the source code directory:
Create the **applications/sample/hello/src/helloworld.c** directory and file whose code is shown in the following example. You can customize the content to be printed. For example, you can change **World** to **OH**. Declare the string printing function **HelloPrint** in the **helloworld.h** file. You can use either C or C++ to develop a program. Create the **applications/sample/hello/src/helloworld.c** directory and file whose code is shown in the following example. You can customize the content to be printed. For example, you can change **World** to **OH**. Declare the string printing function **HelloPrint** in the **helloworld.h** file. You can use either C or C++ to develop a program.
``` ```
#include <stdio.h> #include <stdio.h>
#include "helloworld.h" #include "helloworld.h"
...@@ -55,7 +55,7 @@ Perform the steps below in the source code directory: ...@@ -55,7 +55,7 @@ Perform the steps below in the source code directory:
Add the header file **applications/sample/hello/include/helloworld.h**. The sample code is as follows: Add the header file **applications/sample/hello/include/helloworld.h**. The sample code is as follows:
``` ```
#ifndef HELLOWORLD_H #ifndef HELLOWORLD_H
#define HELLOWORLD_H #define HELLOWORLD_H
...@@ -78,7 +78,7 @@ Perform the steps below in the source code directory: ...@@ -78,7 +78,7 @@ Perform the steps below in the source code directory:
2. Create a build file. 2. Create a build file.
1. Create the **applications/sample/hello/BUILD.gn** file. The file content is as follows: 1. Create the **applications/sample/hello/BUILD.gn** file. The file content is as follows:
``` ```
import("//build/ohos.gni") # Import the build template. import("//build/ohos.gni") # Import the build template.
ohos_executable("helloworld") {# Executable module. ohos_executable("helloworld") {# Executable module.
...@@ -99,7 +99,7 @@ Perform the steps below in the source code directory: ...@@ -99,7 +99,7 @@ Perform the steps below in the source code directory:
} }
``` ```
2. Create the **applications/sample/hello/bundle.json** file and add the description of the **sample** component. The content is as follows: 2. Create the **applications/sample/hello/bundle.json** file and add the description of the **sample** component. The content is as follows:
``` ```
{ {
"name": "@ohos/hello", "name": "@ohos/hello",
...@@ -141,7 +141,7 @@ Perform the steps below in the source code directory: ...@@ -141,7 +141,7 @@ Perform the steps below in the source code directory:
Add the configuration of the new subsystem to the **build/subsystem_config.json** file. Add the configuration of the new subsystem to the **build/subsystem_config.json** file.
``` ```
"sample": { "sample": {
"path": "applications/sample/hello", "path": "applications/sample/hello",
...@@ -153,7 +153,7 @@ Perform the steps below in the source code directory: ...@@ -153,7 +153,7 @@ Perform the steps below in the source code directory:
In the **productdefine/common/products/Hi3516DV300.json** file, add the **hello** part after the existing part. In the **productdefine/common/products/Hi3516DV300.json** file, add the **hello** part after the existing part.
``` ```
"usb:usb_manager_native":{}, "usb:usb_manager_native":{},
"applications:prebuilt_hap":{}, "applications:prebuilt_hap":{},
......
# HiChecker Development
## Overview
HiChecker is a framework provided by OpenHarmony for checking code errors and runtime results. It can be used for checking runtime errors during application and system development. This section applies only to the standard system.
## Development Guidelines
### Use Cases
HiChecker is provided for you to check issues that may be easily ignored during development of OpenHarmony applications (including system-built and third-party applications). Such issues include calling of time-consuming functions by key application threads, event distribution and execution timeout in application processes, and ability resource leakage in application processes. The issues are recorded in logs or lead to process crashes explicitly so that you can notice them and take correction measures.
### Available APIs
HiChecker provides the APIs listed in the following table.
**Table 1** HiChecker APIs
| **API**| **Description**|
| -------- | -------- |
| uint_64_t&nbsp;RULE_CAUTION_PRINT_LOG<br>=&nbsp;1&lt;&lt;63; | Defines an alarm rule, which is programmed to record a log when an alarm is generated.|
| uint_64_t&nbsp;RULE_CAUTION_TRIGGER_CRASH&nbsp;=&nbsp;1&lt;&lt;62; | Defines an alarm rule, which is programmed to force the application to exit when an alarm is generated.|
| uint_64_t&nbsp;RULE_THREAD_CHECK_SLOW_PROCESS&nbsp;=&nbsp;1; | Defines a check rule, which is programmed to check whether any time-consuming function is called.|
| uint_64_t&nbsp;RULE_CHECK_SLOW_EVENT&nbsp;=&nbsp;1&lt;&lt;32; | Defines a check rule, which is programmed to check whether the event distribution or processing time has exceeded the specified time threshold.|
| uint_64_t&nbsp;RULE_CHECK_ABILITY_CONNECTION_LEAK&nbsp;=&nbsp;1&lt;&lt;33; | Defines a check rule, which is programmed to check ability leakage.|
| AddRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.|
| RemoveRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | Removes one or more rules. The removed rules will no longer take effect.|
| GetRule()&nbsp;:&nbsp;uint_64_t | Obtains a collection of thread, process, and alarm rules that have been added.|
| Contains(uint_64_t&nbsp;rule)&nbsp;:&nbsp;bool | Checks whether the collection of added rules contains a specific rule. If a thread-level rule is specified, the system only checks whether it is contained in the current thread.|
| NotifySlowProcess(std::string&nbsp;tag)&nbsp;:&nbsp;void | Notifies your application of a slow process so that your application avoids calling it directly in key threads.|
| NotifySlowEvent(std::string&nbsp;tag)&nbsp;:&nbsp;void | Notifies your application that event distribution or execution has timed out.|
| NotifyAbilityConnectionLeak(Caution&nbsp;caution)&nbsp;:&nbsp;void | Notifies your application that AbilityConnection leakage has occurred.|
| GetTriggerRule()&nbsp;:&nbsp;uint_64_t | Obtains the rule that triggers the current alarm.|
| GetCautionMsg()&nbsp;:&nbsp;std::string | Obtains the alarm message.|
| GetStackTrace()&nbsp;:&nbsp;std::string | Obtains the stack when an alarm is triggered.|
### Development Example
C++
1. Include the following HiChecker header file in the code file:
```
#include "hichecker.h"
```
For a non-DFX subsystem, add the **HiviewDFX** field.
```
using namespace OHOS::HiviewDFX;
```
Use related APIs through static calls.
```
HiChecker::AddRule(Rule::RULE_THREAD_CHECK_SLOW_PROCESS); // Add a rule.
HiChecker::AddRule(Rule::RULE_CHECK_SLOW_EVENT | Rule::RULE_CAUTION_PRINT_LOG); // Add multiple rules.
HiChecker::Contains(Rule::RULE_CAUTION_PRINT_LOG); // true
HiChecker::GetRule(); //RULE_THREAD_CHECK_SLOW_PROCESS | RULE_CHECK_SLOW_EVENT | RULE_CAUTION_PRINT_LOG
```
When a rule is triggered, an alarm is generated based on the rule, and a log is recorded by default.
- RULE_CAUTION_PRINT_LOG
The log prints information such as the rule, thread ID, thread name, and stack that triggers the alarm.
- RULE_CAUTION_TRIGGER_CRASH
The process exits directly, and the log prints the exit prompt and other auxiliary information.
Usage of the **Notify** APIs:
- NotifySlowProcess(std::string tag)
Notifies your application that a slow process has been called. The following is an example of the input arguments:
```
"threadId: xx,threadName:xx,actualTime:xx,delayTime:xx"
```
- NotifySlowEvent(std::string tag)
Notifies your application that event distribution or execution has timed out. The following is an example of the input arguments:
```
"threadId: xx,threadName:xx,eventName:xx,actualTime:xx,delayTime:xx"
```
- NotifyAbilityConnectionLeak(Caution caution)
Notifies your application that AbilityConnection leakage has occurred. The following example shows that a **Caution** instance is passed into this API.
```
Caution caution(Rule::RULE_CHECK_ABILITY_CONNECTION_LEAK , cautionMessage, stackTrace)
// cautionMessage is similar to other Notify APIs.
// stackTrace indicates the stack information when leakage occurs.
```
2. Add the subsystem dependency to the **BUILD.gn** file that has imported the HiChecker module.
```
include_dirs = [ "//base/hiviewdfx/interfaces/innerkits/libhichecker/include" ]
external_deps = [ "hichecker_native:libhichecker" ]
```
# HiDumper Development
## Overview
### Introduction
HiDumper is a tool provided by OpenHarmony for developers, testers, and IDE tool engineers to obtain system information necessary for analyzing and locating faults. This section applies only to the standard system.
### Source Code Directories
```
/base/hiviewdfx/hidumper
├── frameworks # Framework code
│ ├── native # Core function code
│ │ │── include # Header files
│ │ │── src # Source files
│ │ │── common # Common function code
│ │ │── executor # Process executor code
│ │ │── factory # Factory code
│ │ │── manager # Core manager code
│ │ │── util # Utility source code
│── sa_profile # HiDumper SA profile
│── services # HiDumper service code
│ │── native # C++ service code
│ │── zidl # Communication function
│ │ │── include # Header files of the communication function
│ │ │── src # Source code of the communication function
├── test # Test cases
│ ├── unittest # Unit test code
│ ├── moduletest # Module-level test code
```
## Usage
### Command-Line Options
**Table 1** HiDumper command-line options
| Option| Description|
| -------- | -------- |
| -h | Shows the help Information.|
| -t&nbsp;[timeout] | Specifies the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.|
| -lc | Shows the system information cluster list.|
| -ls | Shows the system ability list.|
| -c | Exports system cluster information.|
| -c&nbsp;[base&nbsp;system] | Exports system cluster information based on **base** or **system** tags.|
| -s | Exports all system ability information.|
| -s&nbsp;[SA0&nbsp;SA1] | Exports ability information corresponding to SA0 and SA1.|
| -s&nbsp;[SA]&nbsp;-a&nbsp;['-h'] | Exports the system ability information **SA** using the **-h** parameter.|
| -e | Exports crash logs generated by the FaultLogger module.|
| --net | Exports network information.|
| --storage | Exports storage information.|
| -p | Exports the process list and all process information.|
| -p&nbsp;[pid] | Exports all information about a specified process.|
| --cpuusage&nbsp;[pid] | Exports the CPU usage information based on **pid**.|
| --cpufreq | Exports the actual CPU frequency.|
| --mem&nbsp;[pid] | Exports the memory usage information based on **pid**.|
| --zip | Compresses the exported information to a specified folder.|
### Development Example
HiDumper helps you export basic system information to locate and analyze faults. Complex parameters passed to sub-services and abilities must be enclosed in double quotation marks.
The procedure is as follows:
1. Access the device CLI, and run the **hidumper -h** command to obtain the help information, which includes basic information and function syntax.
```
hidumper -h
```
2. Run the **hidumper -lc** command to obtain the system information cluster list.
```
hidumper -lc
```
3. Run the **hidumper -c** command to obtain all information that is classified by **base** and **system**.
```
hidumper -c
```
4. Run the **hidumper -c [base | system]** to obtain the system cluster information that is classified by **base** or **system**.
```
hidumper -c base
hidumper -c system
```
5. Run the **hidumper -ls** command to obtain the system ability list.
```
hidumper -ls
```
6. Run the **hidumper -s** command to obtain all system ability information.
```
hidumper -s
```
7. Run the **hidumper -s 3301 -a "-h"** command to obtain the help information about the ability whose ID is **3301**.
```
hidumper -s 3301 -a "-h"
```
8. Run the **hidumper -s 3008** command to obtain all information about the ability whose ID is **3008**.
```
hidumper -s 3008
```
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLogger module.
```
hidumper -e
```
10. Run the **hidumper --net** command to obtain network information.
```
hidumper --net
```
11. Run the **hidumper --storage** command to obtain storage information.
```
hidumper --storage
```
12. Run the **hidumper -p** command to obtain process information, including the list and information of processes and threads.
```
hidumper -p
```
13. Run the **hidumper -p 1024** command to obtain information about the process whose PID is **1024**.
```
hidumper -p 1024
```
14. Run the **hidumper --cpuusage [pid]** command to obtain the CPU usage information of the process whose PID has been specified.
```
hidumper --cpuusage
hidumper --cpuusage 1024
```
15. Run the **hidumper --cpufreq** command to obtain the actual operating frequency of each CPU core.
```
hidumper --cpufreq
```
16. Run the **hidumper --mem [pid]** command to obtain all memory usage information of the process whose PID has been specified.
```
hidumper --mem [pid]
```
17. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory.
```
hidumper --zip
```
18. Run the **hidumper -t timeout** command to set the timeout period, in seconds. The default value is **30**. Value **0** indicates no timeout limit.
```
hidumper -t [timeout]
```
...@@ -4,11 +4,14 @@ ...@@ -4,11 +4,14 @@
The DFX subsystem provides the following functions: The DFX subsystem provides the following functions:
- HiLog: implements the logging function. It is applicable to Mini-System Devices \(reference memory ≥ 128 KiB\), Small-System Devices \(reference memory ≥ 1 MiB\), and Standard-System Devices \(reference memory ≥ 128 MB\). - HiLog: implements the logging function. It is applicable to mini-system devices \(reference memory ≥ 128 KiB\), small-system devices \(reference memory ≥ 1 MiB\), and standard-system devices \(reference memory ≥ 128 MB\).
- HiTrace: implements distributed call chain tracing. It is applicable to Standard-System Devices \(reference memory ≥ 128 MB\). - HiTrace: implements distributed call chain tracing. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiCollie: implements thread suspension detection. It is applicable to Standard-System Devices \(reference memory ≥ 128 MB\). - HiCollie: implements thread suspension detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiSysEvent: implements system event logging. It is applicable to Standard-System Devices \(reference memory ≥ 128 MB\). - HiSysEvent: implements system event logging. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiChecker: implements defect scanning. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- HiDumper: exports system information. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
- FaultLogger: implements crash detection. It is applicable to standard-system devices \(reference memory ≥ 128 MiB\).
## Basic Concepts<a name="section5635178134811"></a> ## Basic Concepts<a name="section5635178134811"></a>
...@@ -31,4 +34,3 @@ Event logging means to collect and log events reported during system running. Th ...@@ -31,4 +34,3 @@ Event logging means to collect and log events reported during system running. Th
**System event** **System event**
A system event is an indication of the system status at a given time point during system running. You can use these events to analyze the status change of the system. A system event is an indication of the system status at a given time point during system running. You can use these events to analyze the status change of the system.
# OpenHarmony Device Development Documentation
- [Device Development Guide](device-dev-guide.md) - [Device Development Guide](device-dev-guide.md)
- Quick Start - Getting Started
- Getting Started with Mini and Small Systems (IDE Mode, Recommended) - Getting Started with Mini and Small Systems (IDE Mode, Recommended)
- [Mini and Small System Overview](quick-start/quickstart-ide-lite-overview.md) - [Mini and Small System Overview](quick-start/quickstart-ide-lite-overview.md)
- Environment Preparation - Environment Preparation
...@@ -20,8 +21,9 @@ ...@@ -20,8 +21,9 @@
- [Burning](quick-start/quickstart-ide-lite-steps-hi3516-burn.md) - [Burning](quick-start/quickstart-ide-lite-steps-hi3516-burn.md)
- [Running](quick-start/quickstart-ide-lite-steps-hi3516-running.md) - [Running](quick-start/quickstart-ide-lite-steps-hi3516-running.md)
- Appendix - Appendix
- [Introduction to the Hi3861 Development Board](quick-start/quickstart-ide-lite-introduction-hi3861.md) - Introduction to Development Boards
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-lite-introduction-hi3516.md) - [Introduction to the Hi3861 Development Board](quick-start/quickstart-ide-lite-introduction-hi3861.md)
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-lite-introduction-hi3516.md)
- Getting Started with Mini and Small Systems (Installation Package Mode) - Getting Started with Mini and Small Systems (Installation Package Mode)
- [Mini and Small System Overview](quick-start/quickstart-lite-overview.md) - [Mini and Small System Overview](quick-start/quickstart-lite-overview.md)
- [Environment Preparation](quick-start/quickstart-lite-env-setup.md) - [Environment Preparation](quick-start/quickstart-lite-env-setup.md)
...@@ -67,8 +69,9 @@ ...@@ -67,8 +69,9 @@
- [Burning](quick-start/quickstart-ide-standard-running-rk3568-burning.md) - [Burning](quick-start/quickstart-ide-standard-running-rk3568-burning.md)
- [Running](quick-start/quickstart-ide-standard-running-rk3568-running.md) - [Running](quick-start/quickstart-ide-standard-running-rk3568-running.md)
- Appendix - Appendix
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) - Introduction to Development Boards
- [Introduction to the RK3568 Development Board](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-standard-board-introduction-hi3516.md)
- [Introduction to the RK3568 Development Board](quick-start/quickstart-ide-standard-board-introduction-rk3568.md)
- Getting Started with Standard System (Installation Package Mode) - Getting Started with Standard System (Installation Package Mode)
- [Standard System Overview](quick-start/quickstart-standard-overview.md) - [Standard System Overview](quick-start/quickstart-standard-overview.md)
- [Setting Up Environments for Standard System](quick-start/quickstart-standard-env-setup.md) - [Setting Up Environments for Standard System](quick-start/quickstart-standard-env-setup.md)
...@@ -92,14 +95,14 @@ ...@@ -92,14 +95,14 @@
- [Introduction to the Hi3516 Development Board](quick-start/quickstart-standard-board-introduction-hi3516.md) - [Introduction to the Hi3516 Development Board](quick-start/quickstart-standard-board-introduction-hi3516.md)
- [Introduction to the RK3568 Development Board](quick-start/quickstart-standard-board-introduction-rk3568.md) - [Introduction to the RK3568 Development Board](quick-start/quickstart-standard-board-introduction-rk3568.md)
- [Reference](quick-start/quickstart-standard-reference.md) - [Reference](quick-start/quickstart-standard-reference.md)
- [Obtaining Source Code](get-code/sourcecode-acquire.md) - [Obtaining Source Code](get-code/sourcecode-acquire.md)
- Compatibility and Security - Compatibility and Security
- [Privacy Protection](security/security-privacy-protection.md) - [Privacy Protection](security/security-privacy-protection.md)
- [Security Guidelines](security/security-guidelines-overall.md) - [Security Guidelines](security/security-guidelines-overall.md)
- Porting - Porting
- Mini System SoC Porting Guide - Mini System SoC Porting Guide
- Porting Preparations - Porting Preparations
- [Before You Start](porting/oem_transplant_chip_prepare_knows.md) - [Before You Start](porting/porting-chip-prepare-knows.md)
- [Building Adaptation Process](porting/porting-chip-prepare-process.md) - [Building Adaptation Process](porting/porting-chip-prepare-process.md)
- Kernel Porting - Kernel Porting
- [Overview](porting/porting-chip-kernel-overview.md) - [Overview](porting/porting-chip-kernel-overview.md)
...@@ -133,8 +136,8 @@ ...@@ -133,8 +136,8 @@
- [Porting a Library Built Using CMake](porting/porting-thirdparty-cmake.md) - [Porting a Library Built Using CMake](porting/porting-thirdparty-cmake.md)
- [Porting a Library Built Using Makefile](porting/porting-thirdparty-makefile.md) - [Porting a Library Built Using Makefile](porting/porting-thirdparty-makefile.md)
- Mini System SoC Porting Cases - Mini System SoC Porting Cases
- [Mini-System Devices with Screens — Bestechnic SoC Porting Case](porting/porting-bes2600w-on-minisystem-display-demo.md) - [Mini-System Devices with Screens — Bestechnic SoC Porting Case](porting-bes2600w-on-minisystem-display-demo.md)
- [Combo Solution – ASR Chip Porting Case](porting/porting-asr582x-combo-demo.md) - [Combo Solution – ASR Chip Porting Case](porting-asr582x-combo-demo.md)
- Subsystem Development - Subsystem Development
- Kernel - Kernel
- Kernel for Mini Systems - Kernel for Mini Systems
...@@ -170,8 +173,7 @@ ...@@ -170,8 +173,7 @@
- [LMS](kernel/kernel-mini-memory-lms.md) - [LMS](kernel/kernel-mini-memory-lms.md)
- Appendix - Appendix
- [Kernel Coding Specification](kernel/kernel-mini-appx-code.md) - [Kernel Coding Specification](kernel/kernel-mini-appx-code.md)
- Basic Data Structure - [Doubly Linked List](kernel/kernel-mini-appx-data-list.md)
- [Doubly Linked List](kernel/kernel-mini-appx-data-list.md)
- Standard Libraries - Standard Libraries
- [CMSIS Support](kernel/kernel-mini-appx-lib-cmsis.md) - [CMSIS Support](kernel/kernel-mini-appx-lib-cmsis.md)
- [POSIX Support](kernel/kernel-mini-appx-lib-posix.md) - [POSIX Support](kernel/kernel-mini-appx-lib-posix.md)
...@@ -245,8 +247,6 @@ ...@@ -245,8 +247,6 @@
- [uname](kernel/kernel-small-debug-shell-cmd-uname.md) - [uname](kernel/kernel-small-debug-shell-cmd-uname.md)
- [vmm](kernel/kernel-small-debug-shell-cmd-vmm.md) - [vmm](kernel/kernel-small-debug-shell-cmd-vmm.md)
- [watch](kernel/kernel-small-debug-shell-cmd-watch.md) - [watch](kernel/kernel-small-debug-shell-cmd-watch.md)
- [reboot](kernel/kernel-small-debug-shell-cmd-reboot.md)
- [top](kernel/kernel-small-debug-shell-cmd-top.md)
- File Commands - File Commands
- [cat](kernel/kernel-small-debug-shell-file-cat.md) - [cat](kernel/kernel-small-debug-shell-file-cat.md)
- [cd](kernel/kernel-small-debug-shell-file-cd.md) - [cd](kernel/kernel-small-debug-shell-file-cd.md)
...@@ -269,8 +269,6 @@ ...@@ -269,8 +269,6 @@
- [touch](kernel/kernel-small-debug-shell-file-touch.md) - [touch](kernel/kernel-small-debug-shell-file-touch.md)
- [writeproc](kernel/kernel-small-debug-shell-file-write.md) - [writeproc](kernel/kernel-small-debug-shell-file-write.md)
- [umount](kernel/kernel-small-debug-shell-file-umount.md) - [umount](kernel/kernel-small-debug-shell-file-umount.md)
- [du](kernel/kernel-small-debug-shell-file-du.md)
- [mv](kernel/kernel-small-debug-shell-file-mv.md)
- Network Commands - Network Commands
- [arp](kernel/kernel-small-debug-shell-net-arp.md) - [arp](kernel/kernel-small-debug-shell-net-arp.md)
- [dhclient](kernel/kernel-small-debug-shell-net-dhclient.md) - [dhclient](kernel/kernel-small-debug-shell-net-dhclient.md)
...@@ -285,8 +283,8 @@ ...@@ -285,8 +283,8 @@
- [Magic Key](kernel/kernel-small-debug-shell-magickey.md) - [Magic Key](kernel/kernel-small-debug-shell-magickey.md)
- [User-Space Exception Information](kernel/kernel-small-debug-shell-error.md) - [User-Space Exception Information](kernel/kernel-small-debug-shell-error.md)
- [Trace](kernel/kernel-small-debug-trace.md) - [Trace](kernel/kernel-small-debug-trace.md)
- [perf](kernel/kernel-mini-memory-perf.md) - [perf](kernel/kernel-mini-memory-perf)
- [LMS](kernel/kernel-small-memory-lms.md) - [LMS](kernel/kernel-small-memory-lms)
- [CPUP](kernel/kernel-small-debug-process-cpu.md) - [CPUP](kernel/kernel-small-debug-process-cpu.md)
- Memory Debugging - Memory Debugging
- [Memory Information Statistics](kernel/kernel-small-debug-memory-info.md) - [Memory Information Statistics](kernel/kernel-small-debug-memory-info.md)
...@@ -328,31 +326,39 @@ ...@@ -328,31 +326,39 @@
- [HDF Development Example](driver/driver-hdf-sample.md) - [HDF Development Example](driver/driver-hdf-sample.md)
- Platform Driver Development - Platform Driver Development
- [ADC](driver/driver-platform-adc-develop.md) - [ADC](driver/driver-platform-adc-develop.md)
- [DAC](driver/driver-platform-dac-develop.md)
- [GPIO](driver/driver-platform-gpio-develop.md) - [GPIO](driver/driver-platform-gpio-develop.md)
- [HDMI](driver/driver-platform-hdmi-develop.md) - [HDMI](driver/driver-platform-hdmi-develop.md)
- [I2C](driver/driver-platform-i2c-develop.md) - [I2C](driver/driver-platform-i2c-develop.md)
- [I3C](driver/driver-platform-i3c-develop.md) - [I3C](driver/driver-platform-i3c-develop.md)
- [MIPI CSI](driver/driver-platform-mipicsi-develop.md)
- [MIPI DSI](driver/driver-platform-mipidsi-develop.md) - [MIPI DSI](driver/driver-platform-mipidsi-develop.md)
- [MMC](driver/driver-platform-mmc-develop.md) - [MMC](driver/driver-platform-mmc-develop.md)
- [PIN](driver/driver-platform-pin-develop.md)
- [PWM](driver/driver-platform-pwm-develop.md) - [PWM](driver/driver-platform-pwm-develop.md)
- [Regulator](driver/driver-platform-regulator-develop.md)
- [RTC](driver/driver-platform-rtc-develop.md) - [RTC](driver/driver-platform-rtc-develop.md)
- [SDIO](driver/driver-platform-sdio-develop.md) - [SDIO](driver/driver-platform-sdio-develop.md)
- [SPI](driver/driver-platform-spi-develop.md) - [SPI](driver/driver-platform-spi-develop.md)
- [UART](driver/driver-platform-uart-develop.md) - [UART](driver/driver-platform-uart-develop.md)
- [Watchdog](driver/driver-platform-watchdog-develop.md) - [WatchDog](driver/driver-platform-watchdog-develop.md)
- Platform Driver Usage - Platform Driver Usage
- [ADC](driver/driver-platform-adc-des.md) - [ADC](driver/driver-platform-adc-des.md)
- [DAC](driver/driver-platform-dac-des.md)
- [GPIO](driver/driver-platform-gpio-des.md) - [GPIO](driver/driver-platform-gpio-des.md)
- [HDMI](driver/driver-platform-hdmi-des.md) - [HDMI](driver/driver-platform-hdmi-des.md)
- [I2C](driver/driver-platform-i2c-des.md) - [I2C](driver/driver-platform-i2c-des.md)
- [I3C](driver/driver-platform-i3c-des.md) - [I3C](driver/driver-platform-i3c-des.md)
- [MIPI CSI](driver/driver-platform-mipicsi-des.md)
- [MIPI DSI](driver/driver-platform-mipidsi-des.md) - [MIPI DSI](driver/driver-platform-mipidsi-des.md)
- [PIN](driver/driver-platform-pin-des.md)
- [PWM](driver/driver-platform-pwm-des.md) - [PWM](driver/driver-platform-pwm-des.md)
- [Regulator](driver/driver-platform-regulator-des.md)
- [RTC](driver/driver-platform-rtc-des.md) - [RTC](driver/driver-platform-rtc-des.md)
- [SDIO](driver/driver-platform-sdio-des.md) - [SDIO](driver/driver-platform-sdio-des.md)
- [SPI](driver/driver-platform-spi-des.md) - [SPI](driver/driver-platform-spi-des.md)
- [UART](driver/driver-platform-uart-des.md) - [UART](driver/driver-platform-uart-des.md)
- [Watchdog](driver/driver-platform-watchdog-des.md) - [WatchDog](driver/driver-platform-watchdog-des.md)
- Peripheral Driver Usage - Peripheral Driver Usage
- [LCD](driver/driver-peripherals-lcd-des.md) - [LCD](driver/driver-peripherals-lcd-des.md)
- [Touchscreen](driver/driver-peripherals-touch-des.md) - [Touchscreen](driver/driver-peripherals-touch-des.md)
...@@ -361,6 +367,8 @@ ...@@ -361,6 +367,8 @@
- [Audio](driver/driver-peripherals-audio-des.md) - [Audio](driver/driver-peripherals-audio-des.md)
- [USB](driver/driver-peripherals-usb-des.md) - [USB](driver/driver-peripherals-usb-des.md)
- [Camera](driver/driver-peripherals-camera-des.md) - [Camera](driver/driver-peripherals-camera-des.md)
- [Vibrator](driver/driver-peripherals-vibrator-des.md)
- [Light](driver/driver-peripherals-light-des.md)
- Compilation and Building - Compilation and Building
- [Building Guidelines for Mini and Small Systems](subsystems/subsys-build-mini-lite.md) - [Building Guidelines for Mini and Small Systems](subsystems/subsys-build-mini-lite.md)
- [Building Guidelines for Standard Systems](subsystems/subsys-build-standard-large.md) - [Building Guidelines for Standard Systems](subsystems/subsys-build-standard-large.md)
...@@ -379,7 +387,7 @@ ...@@ -379,7 +387,7 @@
- [Development Guidelines on Photographing](subsystems/subsys-multimedia-camera-photo-guide.md) - [Development Guidelines on Photographing](subsystems/subsys-multimedia-camera-photo-guide.md)
- [Development Guidelines on Video Recording](subsystems/subsys-multimedia-camera-record-guide.md) - [Development Guidelines on Video Recording](subsystems/subsys-multimedia-camera-record-guide.md)
- [Development Guidelines on Previewing](subsystems/subsys-multimedia-camera-preview-guide.md) - [Development Guidelines on Previewing](subsystems/subsys-multimedia-camera-preview-guide.md)
- Audio/Video - Audio and Video
- [Overview](subsystems/subsys-multimedia-video-overview.md) - [Overview](subsystems/subsys-multimedia-video-overview.md)
- [Development Guidelines on Media Playback](subsystems/subsys-multimedia-video-play-guide.md) - [Development Guidelines on Media Playback](subsystems/subsys-multimedia-video-play-guide.md)
- [Development Guidelines on Media Recording](subsystems/subsys-multimedia-video-record-guide.md) - [Development Guidelines on Media Recording](subsystems/subsys-multimedia-video-record-guide.md)
...@@ -422,16 +430,15 @@ ...@@ -422,16 +430,15 @@
- [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md) - [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md)
- [Development Guidelines](subsystems/subsys-application-framework-guide.md) - [Development Guidelines](subsystems/subsys-application-framework-guide.md)
- [Development Example](subsystems/subsys-application-framework-demo.md) - [Development Example](subsystems/subsys-application-framework-demo.md)
- [OTA Upgrade](subsystems/subsys-ota-guide.md) - [OTA Update](subsystems/subsys-ota-guide.md)
- Telephony Service - Telephony
- [Telephony Service](subsystems/telephony-service.md) - [Telephony Overview](subsystems/subsys-tel-overview.md)
- [Development Guidelines](subsystems/development-guidelines.md) - [Telephony Development](subsystems/subsys-tel-guide.md)
- Security - Security
- [Overview](subsystems/subsys-security-overview.md) - [Overview](subsystems/subsys-security-overview.md)
- [Development Guidelines on Application Signature Verification](subsystems/subsys-security-sigverify.md) - [Development Guidelines on Application Signature Verification](subsystems/subsys-security-sigverify.md)
- [Development Guidelines on Application Permission Management](subsystems/subsys-security-rightmanagement.md) - [Development Guidelines on Application Permission Management](subsystems/subsys-security-rightmanagement.md)
- [Development Guidelines on IPC Authentication](subsystems/subsys-security-communicationverify.md) - [Development Guidelines on IPC Authentication](subsystems/subsys-security-communicationverify.md)
- [Development on Device Security Level Management](subsystems/subsys-security-devicesecuritylevel.md)
- Startup - Startup
- [Startup](subsystems/subsys-boot-overview.md) - [Startup](subsystems/subsys-boot-overview.md)
- [init Module](subsystems/subsys-boot-init.md) - [init Module](subsystems/subsys-boot-init.md)
...@@ -470,7 +477,7 @@ ...@@ -470,7 +477,7 @@
- [Photographing](guide/device-iotcamera-control-demo-photodevguide.md) - [Photographing](guide/device-iotcamera-control-demo-photodevguide.md)
- [Video Recording](guide/device-iotcamera-control-demo-videodevguide.md) - [Video Recording](guide/device-iotcamera-control-demo-videodevguide.md)
- [Use Case](guide/device-iotcamera-control-example.md) - [Use Case](guide/device-iotcamera-control-example.md)
- Cameras with a Screen - Cameras with a Screen)
- Screen and Camera Control - Screen and Camera Control
- [Overview](guide/device-camera-control-overview.md) - [Overview](guide/device-camera-control-overview.md)
- Development Guidelines - Development Guidelines
...@@ -493,10 +500,10 @@ ...@@ -493,10 +500,10 @@
- [Development Example for Peripheral Drivers](guide/device-outerdriver-demo.md) - [Development Example for Peripheral Drivers](guide/device-outerdriver-demo.md)
- Debugging - Debugging
- [Test Subsystem](subsystems/subsys-testguide-test.md) - [Test Subsystem](subsystems/subsys-testguide-test.md)
- [R&D Tools](subsystems/subsys-toolchain.md) - Debugging Tools
- [bytrace Usage Guidelines](subsystems/subsys-toolchain-bytrace-guide.md) - [bytrace Usage Guidelines](subsystems/subsys-toolchain-bytrace-guide.md)
- [hdc_std Usage Guidelines](subsystems/subsys-toolchain-hdc-guide.md) - [hdc_std Usage Guidelines](subsystems/subsys-toolchain-hdc-guide.md)
- [XTS](subsystems/subsys-xts-guide.md) - [XTS Certification](subsystems/subsys-xts-guide.md)
- Tools - Tools
- [Docker Environment](get-code/gettools-acquire.md) - [Docker Environment](get-code/gettools-acquire.md)
- [IDE](get-code/gettools-ide.md) - [IDE](get-code/gettools-ide.md)
......
# 应用上下文使用指导
## Context概述
​ context是应用中对象的上下文,提供获取应用程序环境信息的能力。
## Context整体结构介绍
​ OpenHarmony的应用框架分为FA模型和Stage两种模型。对应存在两套Context机制适配两种应用框架模型:
**application/BaseContext** 属于一个通用的Context基类,既不属于FA模型也不属于Stage模型,里面只有一个属性stageMode,用来区分开发模型是FA还是Stage。
**FA模型** 只有app/Context中的方法属于FA模型对应的Context。该模式下,应用级别的Context和Ability级别的Context都是该类型的实例,如果在应用级别的Context里面调用了Ability级别的方法,会产生错误。所以开发者需要注意context实例所代表的实际含义。
**Stage模型** 除了app/Context之外的Context都属于Stage模型,分别有application/Context、application/AbilityStageContext、application/ExtensionContext、application/AbilityContext、application/FormExtensionContext和application/ServiceExtensionContext六种Context。这些Context的介绍及使用方式将会在[Stage模型和Context详细介绍](#stage模型和context详细介绍)种进行说明。
![contextIntroduction](figures/contextIntroduction.png)
## FA模型的Context详细介绍
​ 只有app/Context中的方法属于FA模型对应的Context。
​ FA模型只有一个Context定义。Context中所有的功能都是通过方法来提供的,它提供了一些featureAbility中不存在的方法,相当于featureAbility的一个扩展和补全。
​ d.ts文件如下:
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/app/context.d.ts
​ 应用的使用方式:
```javascript
// 1.引入featureAbility
import featureAbility from '@ohos.ability.featureAbility'
export default {
onCreate() {
console.log('Application onCreate')
// 2.获取Context
let context = featureAbility.getContext();
// 3.调用对应的方法
context.setShowOnLockScreen(false, (data) => {
console.log("data: " + JSON.stringify(data));
});
},
onActive() {
console.log('Application onActive')
},
onDestroy() {
console.log('Application onDestroy')
},
}
```
## Stage模型和Context详细介绍
​ Stage模型有6大Context:
### application/Context
**概述**
​ application/Context类型的Context是基类Context,里面提供了应用的一些基础信息:resourceManager、applicationInfo、cacheDir等,还有应用的一些基本方法:createBundleContext、switchArea等。应用级别的Context也是application/Context这种类型。
**获取方法**
​ 需要在AbilityStage、Ability、Extension等组件中通过context.getApplicationContext()拿到。
**示例**
```javascript
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate is called' + want + launchParam);
// 获取ApplicationContext
let appContext = this.context.getApplicationContext();
// 获取路径
console.log('filesDir is ' + appContext.filesDir);
}
onDestroy() {
console.log('MainAbility onDestroy is called');
}
}
```
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/Context.d.ts
### application/AbilityStageContext
**概述**
​ application/AbilityStageContext是Hap包级别的Context。和基类Context相比,Hap包级别的Context中多了HapModuleInfo和Configuration两个信息。
**获取方法**
​ 可以直接在AbilityStage中通过context属性拿到。
**示例**
```javascript
export default class MyAbilityStage extends AbilityStage {
onCreate() {
// 属性context就是AbilityStageContext类型的
console.log('HapModuleInfo is ' + context.currentHapModuleInfo);
}
}
```
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/AbilityStageContext.d.ts
### application/AbilityContext
**概述**
​ Stage模型下,每个Ability中都包含了一个Context属性。
​ Ability功能主要是处理生命周期,其余操作Ability的方法(如startAbility、connectAbility等)都是在AbilityContext中实现的。
**获取方法**
​ 在Ability中通过context属性拿到。
**示例**
```javascript
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate is called' + want + launchParam);
var want = {
"bundleName": "com.example.MyApplication",
"abilityName": "ServiceExtAbility",
}
// 1.这里的Context就是AbilityContext
let contxt = this.context;
// 2.startAbility
contxt.startAbility(want).then((data) => {
console.info("startAbility success:" + JSON.stringify(data));
}).catch((error) => {
console.error("startAbility failed:" + JSON.stringify(error));
});
}
onDestroy() {
console.log("MainAbility on Destroy is called");
}
}
```
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/AbilityContext.d.ts
### application/ExtensionContext
**概述**
​ 和FA模型不同的是,Stage模型把Service从Ability中剥离出来,单独定义了一组通用扩展类Extension用来处理等同的功能。Extension是一个基类,不承担具体业务功能。业务方根据自己的需要去扩展对应的Extension,例如:ServiceAbility扩展为了ServiceExtensionAbility,卡片扩展为了FormExtension。
​ 因此新增了一种和Extension匹配的ExtensionContext。ExtensionContext中包含HapModuleInfo和Configuration两个属性。
**获取方法**
​ 不会单独使用。
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/ExtensionContext.d.ts
### application/ServiceExtensionContext
**概述**
​ ServiceExtensionAbility类似于FA模型的ServiceAbility,里面只有生命周期回调相关的处理。
​ 操作ServiceExtensionAbility的方法移动到了ServiceExtensionContext中(如startAbility、connectAbility等)。
**获取方法**
​ ServiceExtensionAbility中通过context属性获取。
**示例**
```javascript
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info("ServiceAbility onCreate**");
// 1.这里的Context就是ServiceExtensionContext
let contxt = this.context;
}
onRequest(want, startId) {
console.info("ServiceAbility onRequest**");
}
onConnect(want) {
console.info("ServiceAbility onConnect**");
return new StubTest("test");
}
onDisconnect(want) {
console.info("ServiceAbility onDisconnect**");
}
onDestroy() {
console.info("ServiceAbility onDestroy**");
}
}
```
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/ServiceExtensionContext.d.ts
### application/FormExtensionContext
[FormExtensionContext](/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md)
**d.ts声明**
​ https://gitee.com/openharmony/interface_sdk-js/blob/master/api/application/FormExtensionContext.d.ts
## 常见问题
**通过globalThis去获取Context**
**结论**
​ FA模型可以通过该方式去获取;Stage模型不可通过该方式去获取,要通过对应组件的属性去获取。
**原因**
​ 应用框架在API8上推出了新的应用模型(Stage模型)。在老的模型(FA模型)下,每个Ability实例有一个js虚拟机实例,所以可以从js引擎的global对象上,获取到一个全局的Ability实例,但是在新的模型(Stage模型)下,整个应用进程共用一个js虚拟机实例,其中可以运行多个Ability实例,这样就不存在一个全局的Ability实例。如果开发者在新的模型(Stage模型)下,调用的API实现仍然走到了获取全局Ability实例的方法,就可能会发生错误或者崩溃。
\ No newline at end of file
...@@ -231,7 +231,7 @@ Form需要在应用配置文件config.json中进行配置。 ...@@ -231,7 +231,7 @@ Form需要在应用配置文件config.json中进行配置。
} }
``` ```
具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-preference-guidelines.md) 具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-storage-guidelines.md)
需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片: 需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片:
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
```javascript ```javascript
export default { export default {
onStart(want) { onStart() {
console.log('ServiceAbility onStart'); console.log('ServiceAbility onStart');
}, },
onCommand(want, restart, startId) { onCommand(want, startId) {
console.log('ServiceAbility onCommand'); console.log('ServiceAbility onCommand');
}, },
onConnect(want) { onConnect(want) {
console.log('ServiceAbility OnConnect'); console.log('ServiceAbility OnConnect');
}, },
onDisconnect() { onDisconnect(want) {
console.log('ServiceAbility OnDisConnect'); console.log('ServiceAbility OnDisConnect');
}, },
onStop() { onStop() {
...@@ -174,7 +174,7 @@ import rpc from "@ohos.rpc"; ...@@ -174,7 +174,7 @@ import rpc from "@ohos.rpc";
let mMyStub; let mMyStub;
export default { export default {
onStart(want) { onStart() {
class MyStub extends rpc.RemoteObject{ class MyStub extends rpc.RemoteObject{
constructor(des) { constructor(des) {
if (typeof des === 'string') { if (typeof des === 'string') {
...@@ -182,7 +182,7 @@ export default { ...@@ -182,7 +182,7 @@ export default {
} }
return null; return null;
} }
onRemoteRequest(code, message, reply, option) { onRemoteRequest(code, data, reply, option) {
console.log("ServiceAbility onRemoteRequest called"); console.log("ServiceAbility onRemoteRequest called");
if (code === 1) { if (code === 1) {
let op1 = data.readInt(); let op1 = data.readInt();
...@@ -197,14 +197,14 @@ export default { ...@@ -197,14 +197,14 @@ export default {
} }
mMyStub = new MyStub("ServiceAbility-test"); mMyStub = new MyStub("ServiceAbility-test");
}, },
onCommand(want, restart, startId) { onCommand(want, startId) {
console.log('ServiceAbility onCommand'); console.log('ServiceAbility onCommand');
}, },
onConnect(want) { onConnect(want) {
console.log('ServiceAbility OnConnect'); console.log('ServiceAbility OnConnect');
return mMyStub; return mMyStub;
}, },
onDisconnect() { onDisconnect(want) {
console.log('ServiceAbility OnDisConnect'); console.log('ServiceAbility OnDisConnect');
}, },
onStop() { onStop() {
...@@ -225,12 +225,12 @@ export default { ...@@ -225,12 +225,12 @@ export default {
```ts ```ts
let mRemote; let mRemote;
function onConnectCallback(element, remote){ function onConnectCallback(element, remote){
console.log('onConnectLocalService onConnectDone element: ' + element); console.log('onConnectRemoteService onConnectDone element: ' + element);
console.log('onConnectLocalService onConnectDone remote: ' + remote); console.log('onConnectRemotelService onConnectDone remote: ' + remote);
mRemote = remote; mRemote = remote;
if (mRemote == null) { if (mRemote == null) {
prompt.showToast({ prompt.showToast({
message: "onConnectLocalService not connected yet" message: "onConnectRemoteService not connected yet"
}); });
return; return;
} }
...@@ -243,7 +243,7 @@ function onConnectCallback(element, remote){ ...@@ -243,7 +243,7 @@ function onConnectCallback(element, remote){
console.log('sendRequest success'); console.log('sendRequest success');
let msg = reply.readInt(); let msg = reply.readInt();
prompt.showToast({ prompt.showToast({
message: "onConnectLocalService connect result: " + msg, message: "onConnectRemoteService connect result: " + msg,
duration: 3000 duration: 3000
}); });
}).catch((e) => { }).catch((e) => {
......
...@@ -244,7 +244,7 @@ Form需要在应用配置文件module.json中进行配置。 ...@@ -244,7 +244,7 @@ Form需要在应用配置文件module.json中进行配置。
} }
``` ```
具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-preference-guidelines.md)。 具体的持久化方法可以参考[轻量级数据存储开发指导](../database/database-storage-guidelines.md)。
需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片: 需要注意的是,卡片使用方在请求卡片时传递给提供方应用的Want数据中存在临时标记字段,表示此次请求的卡片是否为临时卡片:
......
...@@ -159,13 +159,13 @@ ...@@ -159,13 +159,13 @@
- [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md) - [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md)
- [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md) - [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md)
- [语法糖](ui/ts-syntactic-sugar.md) - [语法糖](ui/ts-syntactic-sugar.md)
- 常见组件开发指导 - 常见组件开发指导
- [Button开发指导](ui/ui-ts-basic-components-button.md) - [Button开发指导](ui/ui-ts-basic-components-button.md)
- [Web开发指导](ui/ui-ts-components-web.md) - [Web开发指导](ui/ui-ts-components-web.md)
- 常见布局开发指导 - 常见布局开发指导
- [弹性布局](ui/ui-ts-layout-flex.md) - [弹性布局](ui/ui-ts-layout-flex.md)
- [栅格布局](ui/ui-ts-layout-grid-container.md) - [栅格布局](ui/ui-ts-layout-grid-container.md)
- [媒体查询](ui/ui-ts-layout-mediaquery.md) - [媒体查询](ui/ui-ts-layout-mediaquery.md)
- 体验声明式UI - 体验声明式UI
- [创建声明式UI工程](ui/ui-ts-creating-project.md) - [创建声明式UI工程](ui/ui-ts-creating-project.md)
- [初识Component](ui/ui-ts-components.md) - [初识Component](ui/ui-ts-components.md)
...@@ -198,6 +198,7 @@ ...@@ -198,6 +198,7 @@
- [音频采集开发指导](media/audio-capturer.md) - [音频采集开发指导](media/audio-capturer.md)
- 视频 - 视频
- [视频播放开发指导](media/video-playback.md) - [视频播放开发指导](media/video-playback.md)
- [视频录制开发指导](media/video-recorder.md)
- 图片 - 图片
- [图片开发指导](media/image.md) - [图片开发指导](media/image.md)
- 安全 - 安全
......
...@@ -9,5 +9,7 @@ ...@@ -9,5 +9,7 @@
- 视频 - 视频
- [视频播放开发指导](video-playback.md) - [视频播放开发指导](video-playback.md)
- [视频录制开发指导](video-recorder.md)
- 图片 - 图片
- [图片开发指导](image.md) - [图片开发指导](image.md)
# 视频录制开发指导
## 场景介绍
视频录制的主要工作是捕获音视频信号,完成音视频编码并保存到文件中,帮助开发者轻松实现音视频录制功能。它允许调用者指定录制的编码格式、封装格式、文件路径等参数。
**图1** 视频录制状态机
![zh-ch_image_video_recorder_state_machine](figures/zh-ch_image_video_recorder_state_machine.png)
**图2** 视频录制零层图
![zh-ch_image_video_recorder_zero](figures/zh-ch_image_video_recorder_zero.png)
## 开发步骤
详细API含义可参考:[媒体服务API文档VideoRecorder](../reference/apis/js-apis-media.md)
### 全流程场景
包含流程:创建实例,设置录制参数,录制视频,暂停录制,恢复录制,停止录制,释放资源等流程。
```js
import media from '@ohos.multimedia.media'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
export class VideoRecorderDemo {
private testFdNumber; // 用于保存fd地址
// pathName是传入的录制文件名,例如:01.mp4,生成后的文件地址:/storage/media/100/local/files/Video/01.mp4
// 使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA
async getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
let fileAsset = await fetchFileResult.getAllObject();
let fdNumber = await fileAsset[0].open('Rw');
this.testFdNumber = "fd://" + fdNumber.toString();
}
}
// 当发生错误上上报的错误回调接口
failureCallback(error) {
console.info('error happened, error name is ' + error.name);
console.info('error happened, error code is ' + error.code);
console.info('error happened, error message is ' + error.message);
}
// 当发生异常时,系统调用的错误回调接口
catchCallback(error) {
console.info('catch error happened, error name is ' + error.name);
console.info('catch error happened, error code is ' + error.code);
console.info('catch error happened, error message is ' + error.message);
}
async videoRecorderDemo() {
let videoRecorder = null; // videoRecorder空对象在createVideoRecorder成功后赋值
let surfaceID = null; // 用于保存getInputSurface返回的surfaceID
// 获取需要录制的视频的fd地址
await this.getFd('01.mp4');
// 录制相关参数配置
let videoProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : 'audio/mp4a-latm',
audioSampleRate : 48000,
fileFormat : 'mp4',
videoBitrate : 48000,
videoCodec : 'video/mp4v-es',
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let videoConfig = {
audioSourceType : 1,
videoSourceType : 0,
profile : videoProfile,
url : this.testFdNumber, // testFdNumber由getFd生成
orientationHint : 0,
location : { latitude : 30, longitude : 130 },
}
// 创建videoRecorder对象
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
console.info('createVideoRecorder success');
} else {
console.info('createVideoRecorder failed');
}
}, this.failureCallback).catch(this.catchCallback);
// 调用prepare完成视频录制前的准备工作
await videoRecorder.prepare(videoConfig).then(() => {
console.info('prepare success');
}, this.failureCallback).catch(this.catchCallback);
// 获取surfaceID并保存下来传递给camera相关接口
await videoRecorder.getInputSurface().then((surface) => {
console.info('getInputSurface success');
surfaceID = surface;
}, this.failureCallback).catch(this.catchCallback);
// 视频录制依赖相机相关接口,以下需要先调用相机起流接口后才能继续执行,具体的相机接口调用请参考sample用例
// 视频录制启动接口
await videoRecorder.start().then(() => {
console.info('start success');
}, this.failureCallback).catch(this.catchCallback);
// 调用pause接口时需要暂停camera出流
await videoRecorder.pause().then(() => {
console.info('pause success');
}, this.failureCallback).catch(this.catchCallback);
// 调用resume接口时需要恢复camera出流
await videoRecorder.resume().then(() => {
console.info('resume success');
}, this.failureCallback).catch(this.catchCallback);
// 停止camera出流后,停止视频录制
await videoRecorder.stop().then(() => {
console.info('stop success');
}, this.failureCallback).catch(this.catchCallback);
// 重置录制相关配置
await videoRecorder.reset().then(() => {
console.info('reset success');
}, this.failureCallback).catch(this.catchCallback);
// 释放视频录制相关资源并释放camera对象相关资源
await videoRecorder.release().then(() => {
console.info('release success');
}, this.failureCallback).catch(this.catchCallback);
// 相关对象置null
videoRecorder = undefined;
surfaceID = undefined;
}
}
```
# Context
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
提供开发者运行代码的上下文环境,包括应用信息、ResourceManager等信息。
## 使用说明
通过AbilityContext等继承实现。
## 属性
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | 是 | 否 | ResourceManager对象。 |
| applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 |
| cacheDir | string | 是 | 否 | 应用在内部存储上的缓存路径。 |
| tempDir | string | 是 | 否 | 应用的临时文件路径。 |
| filesDir | string | 是 | 否 | 应用在内部存储上的文件路径。 |
| databaseDir | string | 是 | 否 | 获取本地数据存储路径。 |
| storageDir | string | 是 | 否 | 获取轻量级数据存储路径。 |
| bundleCodeDir | string | 是 | 否 | 应用安装路径。 |
| distributedFilesDir | string | 是 | 否 | 应用的分布式文件路径。 |
| eventHub | [EventHub](js-apis-eventhub.md) | 是 | 否 | 事件中心信息。|
## Context.createBundleContext
createBundleContext(bundleName: string): Context;
创建指定应用上下文。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| bundleName | string | 是 | 应用bundle名。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 对应创建应用的上下文context。 |
**示例:**
```js
let test = "com.example.test";
let context = this.context.createBundleContext(test);
```
## Context.getApplicationContext
getApplicationContext(): Context;
获取当前context。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Context | 当前Context&nbsp;信息。 |
**示例:**
```js
// 必选项。
let context = this.context.getApplicationContext();
```
...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object ...@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object
- 示例: - 示例:
``` ```js
let xml = let xml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
......
# FormExtensionContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
FormExtension的上下文环境,提供FormExtension具有的能力和接口,继承自ExtensionContext。
## FormExtensionContext.updateForm
updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void
主动更新卡片。
**系统能力**:SystemCapability.Ability.Form
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| formId | string | 是 | 请求更新的卡片ID。 |
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
| callback | AsyncCallback\<void> | 是 | 回调函数,返回接口调用是否成功的结果。 |
**示例:**
```js
let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
this.context.updateForm(formId, obj2, (data)=>{
console.log('FormExtension context updateForm, data:' + data);
});
```
## FormExtensionContext.updateForm
updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\<void>
更新卡片。
**系统能力**:SystemCapability.Ability.Form
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ------------------------------------------------------------ | ---- | ------------------ |
| formId | string | 是 | 请求更新的卡片ID。 |
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------------- |
| Promise\<void> | 返回一个Promise,包含接口的结果。 |
**示例:**
```
let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
this.context.updateForm(formId, obj2)
.then((data)=>{
console.log('FormExtension context updateForm, data:' + data);
}).catch((error) => {
console.error('Operation updateForm failed. Cause: ' + error);});
```
\ No newline at end of file
...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt; ...@@ -60,7 +60,7 @@ wait(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
result.then(val=>{ result.then(val=>{
...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt; ...@@ -85,7 +85,7 @@ getOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls'); var child = process.runCmd('ls');
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt; ...@@ -110,7 +110,7 @@ getErrorOutput(): Promise&lt;Uint8Array&gt;
**示例:** **示例:**
``` ```js
var child = process.runCmd('madir test.text'); var child = process.runCmd('madir test.text');
var result = child.wait(); var result = child.wait();
child.getErrorOutput.then(val=>{ child.getErrorOutput.then(val=>{
...@@ -129,7 +129,7 @@ close(): void ...@@ -129,7 +129,7 @@ close(): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.close(); child.close();
``` ```
...@@ -151,7 +151,7 @@ kill(signal: number | string): void ...@@ -151,7 +151,7 @@ kill(signal: number | string): void
**示例:** **示例:**
``` ```js
var child = process.runCmd('sleep 5; ls'); var child = process.runCmd('sleep 5; ls');
child.kill(9); child.kill(9);
``` ```
...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean ...@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean
**示例:** **示例:**
``` ```js
var result = process.isIsolatedProcess(); var result = process.isIsolatedProcess();
``` ```
...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean ...@@ -200,7 +200,7 @@ isAppUid(v: number): boolean
**示例:** **示例:**
``` ```js
var result = process.isAppUid(688); var result = process.isAppUid(688);
``` ```
...@@ -221,7 +221,7 @@ is64Bit(): boolean ...@@ -221,7 +221,7 @@ is64Bit(): boolean
**示例:** **示例:**
``` ```js
var ressult = process.is64Bit(); var ressult = process.is64Bit();
``` ```
...@@ -248,7 +248,7 @@ getUidForName(v: string): number ...@@ -248,7 +248,7 @@ getUidForName(v: string): number
**示例:** **示例:**
``` ```js
var pres = process.getUidForName("tool") var pres = process.getUidForName("tool")
``` ```
...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number ...@@ -275,7 +275,7 @@ getThreadPriority(v: number): number
**示例:** **示例:**
``` ```js
var tid = process.getTid(); var tid = process.getTid();
var pres = process.getThreadPriority(tid); var pres = process.getThreadPriority(tid);
``` ```
...@@ -297,7 +297,7 @@ getStartRealtime(): number ...@@ -297,7 +297,7 @@ getStartRealtime(): number
**示例:** **示例:**
``` ```js
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
...@@ -317,7 +317,7 @@ getPastCpuTime(): number ...@@ -317,7 +317,7 @@ getPastCpuTime(): number
**示例:** **示例:**
``` ```js
var result = process.getPastCpuTime() ; var result = process.getPastCpuTime() ;
``` ```
...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number ...@@ -344,7 +344,7 @@ getSystemConfig(name: number): number
**示例:** **示例:**
``` ```js
var _SC_ARG_MAX = 0 var _SC_ARG_MAX = 0
var pres = process.getSystemConfig(_SC_ARG_MAX) var pres = process.getSystemConfig(_SC_ARG_MAX)
``` ```
...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string ...@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string
**示例:** **示例:**
``` ```js
var pres = process.getEnvironmentVar("PATH") var pres = process.getEnvironmentVar("PATH")
``` ```
...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri ...@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri
**示例:** **示例:**
``` ```js
var child = process.runCmd('ls', { maxBuffer : 2 }); var child = process.runCmd('ls', { maxBuffer : 2 });
var result = child.wait(); var result = child.wait();
child.getOutput.then(val=>{ child.getOutput.then(val=>{
...@@ -427,7 +427,7 @@ abort(): void ...@@ -427,7 +427,7 @@ abort(): void
**示例:** **示例:**
``` ```js
process.abort(); process.abort();
``` ```
...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void ...@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -484,7 +484,7 @@ off(type: string): boolean ...@@ -484,7 +484,7 @@ off(type: string): boolean
**示例:** **示例:**
``` ```js
process.on("data", (e)=>{ process.on("data", (e)=>{
console.log("data callback"); console.log("data callback");
}) })
...@@ -510,7 +510,7 @@ exit(code: number): void ...@@ -510,7 +510,7 @@ exit(code: number): void
**示例:** **示例:**
``` ```js
process.exit(0); process.exit(0);
``` ```
...@@ -525,7 +525,7 @@ cwd(): string ...@@ -525,7 +525,7 @@ cwd(): string
**示例:** **示例:**
``` ```js
var path = process.cwd(); var path = process.cwd();
``` ```
...@@ -546,7 +546,7 @@ chdir(dir: string): void ...@@ -546,7 +546,7 @@ chdir(dir: string): void
**示例:** **示例:**
``` ```js
process.chdir('/system'); process.chdir('/system');
``` ```
...@@ -567,7 +567,7 @@ uptime(): number ...@@ -567,7 +567,7 @@ uptime(): number
**示例:** **示例:**
``` ```js
var time = process.uptime(); var time = process.uptime();
``` ```
...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean ...@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean
| boolean | 信号是否发送成功。 | | boolean | 信号是否发送成功。 |
**示例:** **示例:**
```
```js
var pres = process.pid var pres = process.pid
var result = that.kill(pres, 28) var result = that.kill(pres, 28)
``` ```
# ServiceExtensionContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
ServiceExtension的上下文环境,提供ServiceExtension具有的能力和接口,继承自ExtensionContext。
## startAbility
startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
启动Ability。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| callback | AsyncCallback&lt;void&gt; | 否 | 回调函数,返回接口调用是否成功的结果。 |
**示例:**
```js
let want = {
"bundleName": "com.example.myapp",
"abilityName": "com.example.myapp.MyAbility"
};
this.context.startAbility(want, (err) => {
console.log('startAbility result:' + JSON.stringfy(err));
});
```
## ServiceExtensionContext.startAbility
startAbility(want: Want): Promise&lt;void&gt;;
启动Ability。通过Promise返回结果。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果。 |
**示例:**
```js
let want = {
"bundleName": "com.example.myapp",
"abilityName": "com.example.myapp.MyAbility"
};
this.context.startAbility(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## ServiceExtensionContext.terminateSelf
terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
停止Ability自身。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | 否 | 回调函数,返回接口调用是否成功的结果。 |
**示例:**
```js
this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err));
});
```
## ServiceExtensionContext.terminateSelf
terminateSelf(): Promise&lt;void&gt;;
停止自身。通过Promise返回结果。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果。 |
**示例:**
```js
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## ServiceExtensionContext.connectAbility
connectAbility(want: Want, options: ConnectOptions): number;
将一个Ability与服务类型的Ability绑定。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| options | [ConnectOptions](#connectoptions) | 是 | ConnectOptions类型的回调函数,返回服务连接成功、断开或连接失败后的信息。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| number | 返回一个number,后续根据这个number去断开连接。 |
**示例:**
```js
let want = {
"bundleName": "com.example.myapp",
"abilityName": "com.example.myapp.MyAbility"
};
let options = {
onConnect: function(elementName, proxy) {},
onDisConnect: function(elementName) {},
onFailed: function(code) {}
}
let connection = this.context.connectAbility(want,options);
```
## ServiceExtensionContext.disconnectAbility
disconnectAbility(connection: number, callback:AsyncCallback&lt;void&gt;): void;
将一个Ability与绑定的服务类型的Ability解绑。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
| callback | AsyncCallback&lt;void&gt; | 否 | 回调函数,返回接口调用是否成功的结果。 |
**示例:**
```js
this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值
console.log('terminateSelf result:' + JSON.stringfy(err));
});
```
## ServiceExtensionContext.disconnectAbility
disconnectAbility(connection: number): Promise&lt;void&gt;;
将一个Ability与绑定的服务类型的Ability解绑。通过Promise返回结果。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果。 |
**示例:**
```js
this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## ConnectOptions
ConnectOptions数据结构。
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 说明 |
| -------- | -------- |
| onConnect(elementName:ElementName,&nbsp;remote:IRemoteObject) | Ability成功连接一个服务类型Ability的回调接口。 |
| onDisconnect(elementName:ElementName) | 对端服务发生异常或者被杀死回调该接口。 |
| onFailed(code:&nbsp;number) | 连接失败时回调该接口。 |
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## 导入模块 ## 导入模块
``` ```typescript
import settings from '@ohos.settings'; import settings from '@ohos.settings';
``` ```
...@@ -34,7 +34,7 @@ getUriSync(name: string): string ...@@ -34,7 +34,7 @@ getUriSync(name: string): string
| string | 数据项的URI。 | | string | 数据项的URI。 |
- 示例: - 示例:
``` ```typescript
// 获取数据项的URI // 获取数据项的URI
let urivar = settings.getUriSync('settings.screen.brightness'); let urivar = settings.getUriSync('settings.screen.brightness');
``` ```
...@@ -61,7 +61,7 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin ...@@ -61,7 +61,7 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin
| string | 返回数据项的值。 | | string | 返回数据项的值。 |
- 示例: - 示例:
``` ```typescript
import featureAbility from '@ohos.featureAbility'; import featureAbility from '@ohos.featureAbility';
//获取数据项亮度的值(该数据项在数据库中已存在) //获取数据项亮度的值(该数据项在数据库中已存在)
...@@ -96,7 +96,7 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): ...@@ -96,7 +96,7 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string):
| boolean | 返回设置数据项的值是否成功的结果。true表示设置成功,false则表示设置失败。 | | boolean | 返回设置数据项的值是否成功的结果。true表示设置成功,false则表示设置失败。 |
- 示例: - 示例:
``` ```typescript
import featureAbility from '@ohos.featureAbility'; import featureAbility from '@ohos.featureAbility';
//更新数据项亮度的值(该数据项在数据库中已存在,故setValueSync方法将更新该数据项的值) //更新数据项亮度的值(该数据项在数据库中已存在,故setValueSync方法将更新该数据项的值)
......
...@@ -46,11 +46,11 @@ constructor是URI的构造函数。 ...@@ -46,11 +46,11 @@ constructor是URI的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; var mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
``` ```js
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080';
``` ```
...@@ -69,7 +69,7 @@ toString(): string ...@@ -69,7 +69,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new uri.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -95,7 +95,7 @@ equals(other: URI): boolean ...@@ -95,7 +95,7 @@ equals(other: URI): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean ...@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -134,7 +134,7 @@ normalize(): URI ...@@ -134,7 +134,7 @@ normalize(): URI
| URI | 返回一个path被规范化后的URI对象。 | | URI | 返回一个path被规范化后的URI对象。 |
**示例:** **示例:**
``` ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
......
...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。 ...@@ -31,7 +31,7 @@ URLSearchParams的构造函数。
**示例:** **示例:**
``` ```js
var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); var objectParams = new URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2}); var objectParams1 = new URLSearchParams({"fod" : 1 , "bard" : 2});
var objectParams2 = new URLSearchParams('?fod=1&bard=2'); var objectParams2 = new URLSearchParams('?fod=1&bard=2');
...@@ -55,7 +55,7 @@ append(name: string, value: string): void ...@@ -55,7 +55,7 @@ append(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); paramsObject.append('fod', 3);
...@@ -76,7 +76,7 @@ delete(name: string): void ...@@ -76,7 +76,7 @@ delete(name: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsobject = new URLSearchParams(urlObject.search.slice(1)); let paramsobject = new URLSearchParams(urlObject.search.slice(1));
paramsobject.delete('fod'); paramsobject.delete('fod');
...@@ -103,7 +103,7 @@ getAll(name: string): string[] ...@@ -103,7 +103,7 @@ getAll(name: string): string[]
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', 3); // Add a second value for the fod parameter. paramsObject.append('fod', 3); // Add a second value for the fod parameter.
...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]> ...@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]>
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2"); var searchParamsObject = new URLSearchParams("keyName1=valueName1&keyName2=valueName2");
for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs for (var pair of searchParamsObject .entries()) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]); console.log(pair[0]+ ', '+ pair[1]);
...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th ...@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
**示例:** **示例:**
``` ```js
const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); const myURLObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => { myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams); console.log(name, value, myURLObject.searchParams === searchParams);
...@@ -185,7 +185,7 @@ get(name: string): string | null ...@@ -185,7 +185,7 @@ get(name: string): string | null
**示例:** **示例:**
``` ```js
var paramsOject = new URLSearchParams(document.location.search.substring(1)); var paramsOject = new URLSearchParams(document.location.search.substring(1));
var name = paramsOject.get("name"); // is the string "Jonathan" var name = paramsOject.get("name"); // is the string "Jonathan"
var age = parseInt(paramsOject.get("age"), 10); // is the number 18 var age = parseInt(paramsOject.get("age"), 10); // is the number 18
...@@ -213,7 +213,7 @@ has(name: string): boolean ...@@ -213,7 +213,7 @@ has(name: string): boolean
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; paramsObject.has('bard') === true;
...@@ -235,7 +235,7 @@ set(name: string, value: string): void ...@@ -235,7 +235,7 @@ set(name: string, value: string): void
**示例:** **示例:**
``` ```js
let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let urlObject = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new URLSearchParams(urlObject.search.slice(1)); let paramsObject = new URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', 3); // Add a third parameter. paramsObject.set('baz', 3); // Add a third parameter.
...@@ -251,7 +251,7 @@ sort(): void ...@@ -251,7 +251,7 @@ sort(): void
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object var searchParamsObject = new URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4 console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=2&c=3&d=4
...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt; ...@@ -273,7 +273,7 @@ keys(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParamsObject = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var key of searchParamsObject .keys()) { // Output key-value pairs for (var key of searchParamsObject .keys()) { // Output key-value pairs
console.log(key); console.log(key);
...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt; ...@@ -295,7 +295,7 @@ values(): IterableIterator&lt;string&gt;
**示例:** **示例:**
``` ```js
var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing var searchParams = new URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
for (var value of searchParams.values()) { for (var value of searchParams.values()) {
console.log(value); console.log(value);
...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) { ...@@ -318,7 +318,7 @@ for (var value of searchParams.values()) {
**示例:** **示例:**
``` ```js
const paramsObject = new URLSearchParams('fod=bay&edg=bap'); const paramsObject = new URLSearchParams('fod=bay&edg=bap');
for (const [name, value] of paramsObject) { for (const [name, value] of paramsObject) {
console.log(name, value); console.log(name, value);
...@@ -341,7 +341,7 @@ toString(): string ...@@ -341,7 +341,7 @@ toString(): string
**示例:** **示例:**
``` ```js
let url = new URL('https://developer.exampleUrl/?fod=1&bard=2'); let url = new URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new URLSearchParams(url.search.slice(1)); let params = new URLSearchParams(url.search.slice(1));
params.append('fod', 3); params.append('fod', 3);
...@@ -386,7 +386,7 @@ URL的构造函数。 ...@@ -386,7 +386,7 @@ URL的构造函数。
**示例:** **示例:**
``` ```js
var mm = 'http://username:password@host:8080'; var mm = 'http://username:password@host:8080';
var a = new URL("/", mm); // Output 'http://username:password@host:8080/'; var a = new URL("/", mm); // Output 'http://username:password@host:8080/';
var b = new URL(mm); // Output 'http://username:password@host:8080/'; var b = new URL(mm); // Output 'http://username:password@host:8080/';
...@@ -416,7 +416,7 @@ toString(): string ...@@ -416,7 +416,7 @@ toString(): string
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString()
``` ```
...@@ -436,7 +436,7 @@ toJSON(): string ...@@ -436,7 +436,7 @@ toJSON(): string
| string | 用于返回网址的字符串序列化。 | | string | 用于返回网址的字符串序列化。 |
**示例:** **示例:**
``` ```js
const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON()
``` ```
...@@ -23,18 +23,18 @@ printf(format: string, ...args: Object[]): string ...@@ -23,18 +23,18 @@ printf(format: string, ...args: Object[]): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| format | string | 是 | 式样化字符串。 | | format | string | 是 | 式样化字符串。 |
| ...args | Object[] | 否 | 待式样化数据。 | | ...args | Object[] | 否 | 待式样化数据。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 按特定格式式样化后的字符串。 | | string | 按特定格式式样化后的字符串。 |
**示例:** **示例:**
``` ```js
var res = util.printf("%s", "hello world!"); var res = util.printf("%s", "hello world!");
console.log(res); console.log(res);
``` ```
...@@ -49,17 +49,17 @@ getErrorString(errno: number): string ...@@ -49,17 +49,17 @@ getErrorString(errno: number): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| errno | number | 是 | 系统发生错误产生的错误码。 | | errno | number | 是 | 系统发生错误产生的错误码。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 错误码对应的详细信息。 | | string | 错误码对应的详细信息。 |
**示例:** **示例:**
``` ```js
var errnum = 10; // 10:a system error number var errnum = 10; // 10:a system error number
var result = util.getErrorString(errnum); var result = util.getErrorString(errnum);
console.log("result = " + result); console.log("result = " + result);
...@@ -76,17 +76,17 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void ...@@ -76,17 +76,17 @@ callbackWrapper(original: Function): (err: Object, value: Object )=&gt;void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | 是 | 异步函数。 | | original | Function | 是 | 异步函数。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Function | 返回一个第一个参数是拒绝原因(如果&nbsp;Promise&nbsp;已解决,则为&nbsp;null),第二个参数是已解决的回调函数。 | | Function | 返回一个第一个参数是拒绝原因(如果&nbsp;Promise&nbsp;已解决,则为&nbsp;null),第二个参数是已解决的回调函数。 |
**示例:** **示例:**
``` ```js
async function promiseFn() { async function promiseFn() {
return Promise.reject('value'); return Promise.reject('value');
} }
...@@ -107,17 +107,17 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object ...@@ -107,17 +107,17 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| original | Function | 是 | 异步函数。 | | original | Function | 是 | 异步函数。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Function | 采用遵循常见的错误优先的回调风格的函数(也就是将&nbsp;(err,&nbsp;value)&nbsp;=&gt;&nbsp;...&nbsp;回调作为最后一个参数),并返回一个返回&nbsp;promise&nbsp;的版本。 | | Function | 采用遵循常见的错误优先的回调风格的函数(也就是将&nbsp;(err,&nbsp;value)&nbsp;=&gt;&nbsp;...&nbsp;回调作为最后一个参数),并返回一个返回&nbsp;promise&nbsp;的版本。 |
**示例:** **示例:**
``` ```js
function aysnFun(str1, str2, callback) { function aysnFun(str1, str2, callback) {
if (typeof str1 === 'string' && typeof str2 === 'string') { if (typeof str1 === 'string' && typeof str2 === 'string') {
callback(null, str1 + str2); callback(null, str1 + str2);
...@@ -154,20 +154,20 @@ TextDecoder的构造函数。 ...@@ -154,20 +154,20 @@ TextDecoder的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| encoding | string | 否 | 编码格式。 | | encoding | string | 否 | 编码格式。 |
| options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 | | options | Object | 否 | 编码相关选项参数,存在两个属性fatal和ignoreBOM。 |
**表1** options **表1** options
| 名称 | 参数类型 | 必填 | 说明 | | 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| fatal | boolean | 否 | 是否显示致命错误。 | | fatal | boolean | 否 | 是否显示致命错误。 |
| ignoreBOM | boolean | 否 | 是否忽略BOM标记。 | | ignoreBOM | boolean | 否 | 是否忽略BOM标记。 |
**示例:** **示例:**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
...@@ -181,24 +181,24 @@ decode(input: Uint8Array, options?: { stream?: false }): string ...@@ -181,24 +181,24 @@ decode(input: Uint8Array, options?: { stream?: false }): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | Unit8Array | 是 | 符合格式需要解码的数组。 | | input | Unit8Array | 是 | 符合格式需要解码的数组。 |
| options | Object | 否 | 解码相关选项参数。 | | options | Object | 否 | 解码相关选项参数。 |
**表2** options **表2** options
| 名称 | 参数类型 | 必填 | 说明 | | 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stream | boolean | 否 | 在随后的decode()调用中是否跟随附加数据块。如果以块的形式处理数据,则设置为true;如果处理最后的数据块或数据未分块,则设置为false。默认为false。 | | stream | boolean | 否 | 在随后的decode()调用中是否跟随附加数据块。如果以块的形式处理数据,则设置为true;如果处理最后的数据块或数据未分块,则设置为false。默认为false。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 解码后的数据。 | | string | 解码后的数据。 |
**示例:** **示例:**
``` ```js
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
...@@ -236,7 +236,7 @@ TextEncoder的构造函数。 ...@@ -236,7 +236,7 @@ TextEncoder的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
``` ```
...@@ -250,17 +250,17 @@ encode(input?: string): Uint8Array ...@@ -250,17 +250,17 @@ encode(input?: string): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | 是 | 需要编码的字符串。 | | input | string | 是 | 需要编码的字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后的文本。 | | Uint8Array | 返回编码后的文本。 |
**示例:** **示例:**
``` ```js
var textEncoder = new util.TextEncoder(); var textEncoder = new util.TextEncoder();
var result = new Uint8Array(buffer); var result = new Uint8Array(buffer);
result = textEncoder.encode("\uD800¥¥"); result = textEncoder.encode("\uD800¥¥");
...@@ -276,18 +276,18 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number } ...@@ -276,18 +276,18 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| input | string | 是 | 需要编码的字符串。 | | input | string | 是 | 需要编码的字符串。 |
| dest | Uint8Array | 是 | Uint8Array对象实例,用于将生成的UTF-8编码文本放入其中。 | | dest | Uint8Array | 是 | Uint8Array对象实例,用于将生成的UTF-8编码文本放入其中。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后的文本。 | | Uint8Array | 返回编码后的文本。 |
**示例:** **示例:**
``` ```js
var that = new util.TextEncoder(); var that = new util.TextEncoder();
var buffer = new ArrayBuffer(4); var buffer = new ArrayBuffer(4);
this.dest = new Uint8Array(buffer); this.dest = new Uint8Array(buffer);
...@@ -306,13 +306,13 @@ RationalNumber的构造函数。 ...@@ -306,13 +306,13 @@ RationalNumber的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| numerator | number | 是 | 分子,整数类型。 | | numerator | number | 是 | 分子,整数类型。 |
| denominator | number | 是 | 分母,整数类型。 | | denominator | number | 是 | 分母,整数类型。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
``` ```
...@@ -326,17 +326,17 @@ static createRationalFromString​(rationalString: string): RationalNumber​ ...@@ -326,17 +326,17 @@ static createRationalFromString​(rationalString: string): RationalNumber​
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| rationalString | string | 是 | 字符串格式。 | | rationalString | string | 是 | 字符串格式。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| object | 返回有理数类的对象。 | | object | 返回有理数类的对象。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
``` ```
...@@ -351,17 +351,17 @@ compareTo​(another: RationalNumber): number​ ...@@ -351,17 +351,17 @@ compareTo​(another: RationalNumber): number​
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| another | RationalNumber | 是 | 其他的有理数对象。 | | another | RationalNumber | 是 | 其他的有理数对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 | | number | 如果两个对象相等,则返回0;如果给定对象小于当前对象,则返回1;如果给定对象大于当前对象,则返回-1。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.compareTo(rational); var result = rationalNumber.compareTo(rational);
...@@ -377,12 +377,12 @@ valueOf(): number ...@@ -377,12 +377,12 @@ valueOf(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回整数或者浮点数的值。 | | number | 返回整数或者浮点数的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.valueOf(); var result = rationalNumber.valueOf();
``` ```
...@@ -397,17 +397,17 @@ equals​(obj: Object): boolean ...@@ -397,17 +397,17 @@ equals​(obj: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| object | Object | 是 | 其他类型对象。 | | object | Object | 是 | 其他类型对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 | | boolean | 如果给定对象与当前对象相同,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var rational = rationalNumer.creatRationalFromString("3/4"); var rational = rationalNumer.creatRationalFromString("3/4");
var result = rationalNumber.equals(rational); var result = rationalNumber.equals(rational);
...@@ -423,18 +423,18 @@ static getCommonDivisor​(number1: number,number2: number): number ...@@ -423,18 +423,18 @@ static getCommonDivisor​(number1: number,number2: number): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| number1 | number | 是 | 整数类型。 | | number1 | number | 是 | 整数类型。 |
| number2 | number | 是 | 整数类型。 | | number2 | number | 是 | 整数类型。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回两个给定数字的最大公约数。 | | number | 返回两个给定数字的最大公约数。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getCommonDivisor(4,6); var result = rationalNumber.getCommonDivisor(4,6);
``` ```
...@@ -450,12 +450,12 @@ getNumerator​(): number ...@@ -450,12 +450,12 @@ getNumerator​(): number
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回RationalNumber对象的分子的值。 | | number | 返回RationalNumber对象的分子的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getNumerator(); var result = rationalNumber.getNumerator();
``` ```
...@@ -470,12 +470,12 @@ getDenominator​(): number ...@@ -470,12 +470,12 @@ getDenominator​(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回RationalNumber对象的分母的值。 | | number | 返回RationalNumber对象的分母的值。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.getDenominator(); var result = rationalNumber.getDenominator();
``` ```
...@@ -490,12 +490,12 @@ isZero​():boolean ...@@ -490,12 +490,12 @@ isZero​():boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 | | boolean | 如果当前对象表示的值为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isZero(); var result = rationalNumber.isZero();
``` ```
...@@ -510,12 +510,12 @@ isNaN​(): boolean ...@@ -510,12 +510,12 @@ isNaN​(): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果分母和分子都为0,则返回true;否则返回false。 | | boolean | 如果分母和分子都为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isNaN(); var result = rationalNumber.isNaN();
``` ```
...@@ -530,12 +530,12 @@ isFinite​():boolean ...@@ -530,12 +530,12 @@ isFinite​():boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果分母不为0,则返回true;否则返回false。 | | boolean | 如果分母不为0,则返回true;否则返回false。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.isFinite(); var result = rationalNumber.isFinite();
``` ```
...@@ -550,12 +550,12 @@ toString​(): string ...@@ -550,12 +550,12 @@ toString​(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 | | string | 返回Numerator/Denominator格式的字符串,例如3/5,如果当前对象的分子和分母都为0,则返回NaN。 |
**示例:** **示例:**
``` ```js
var rationalNumber = new util.RationalNumber(1,2); var rationalNumber = new util.RationalNumber(1,2);
var result = rationalNumber.toString(); var result = rationalNumber.toString();
``` ```
...@@ -571,7 +571,7 @@ toString​(): string ...@@ -571,7 +571,7 @@ toString​(): string
| length | number | 是 | 否 | 当前缓冲区中值的总数。 | | length | number | 是 | 否 | 当前缓冲区中值的总数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(1,8); pro.put(1,8);
...@@ -588,12 +588,12 @@ constructor(capacity?: number) ...@@ -588,12 +588,12 @@ constructor(capacity?: number)
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| capacity | number | 否 | 指示要为缓冲区自定义的容量。 | | capacity | number | 否 | 指示要为缓冲区自定义的容量。 |
**示例:** **示例:**
``` ```js
var lrubuffer= new util.LruBuffer(); var lrubuffer= new util.LruBuffer();
``` ```
...@@ -607,12 +607,12 @@ updateCapacity(newCapacity: number): void ...@@ -607,12 +607,12 @@ updateCapacity(newCapacity: number): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 | | newCapacity | number | 是 | 指示要为缓冲区自定义的容量。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.updateCapacity(100); var result = pro.updateCapacity(100);
``` ```
...@@ -627,12 +627,12 @@ toString(): string ...@@ -627,12 +627,12 @@ toString(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回对象的字符串表示形式。 | | string | 返回对象的字符串表示形式。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -650,12 +650,12 @@ getCapacity(): number ...@@ -650,12 +650,12 @@ getCapacity(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回当前缓冲区的容量。 | | number | 返回当前缓冲区的容量。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.getCapacity(); var result = pro.getCapacity();
``` ```
...@@ -670,7 +670,7 @@ clear(): void ...@@ -670,7 +670,7 @@ clear(): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.size(); var result = pro.size();
...@@ -687,12 +687,12 @@ getCreateCount(): number ...@@ -687,12 +687,12 @@ getCreateCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回createDefault()返回值的次数。 | | number | 返回createDefault()返回值的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(1,8); pro.put(1,8);
var result = pro.getCreateCount(); var result = pro.getCreateCount();
...@@ -708,12 +708,12 @@ getMissCount(): number ...@@ -708,12 +708,12 @@ getMissCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回查询值不匹配的次数。 | | number | 返回查询值不匹配的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -730,12 +730,12 @@ getRemovalCount(): number ...@@ -730,12 +730,12 @@ getRemovalCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回从缓冲区中驱逐的次数。 | | number | 返回从缓冲区中驱逐的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.updateCapacity(2); pro.updateCapacity(2);
...@@ -753,12 +753,12 @@ getMatchCount(): number ...@@ -753,12 +753,12 @@ getMatchCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回查询值匹配成功的次数。 | | number | 返回查询值匹配成功的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.get(2); pro.get(2);
...@@ -775,12 +775,12 @@ getPutCount(): number ...@@ -775,12 +775,12 @@ getPutCount(): number
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| number | 返回将值添加到缓冲区的次数。 | | number | 返回将值添加到缓冲区的次数。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.getPutCount(); var result = pro.getPutCount();
...@@ -796,12 +796,12 @@ isEmpty(): boolean ...@@ -796,12 +796,12 @@ isEmpty(): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果当前缓冲区不包含任何值,则返回true。 | | boolean | 如果当前缓冲区不包含任何值,则返回true。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.isEmpty(); var result = pro.isEmpty();
...@@ -817,17 +817,17 @@ get(key: K): V | undefined ...@@ -817,17 +817,17 @@ get(key: K): V | undefined
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要查询的键。 | | key | K | 是 | 要查询的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 | | V&nbsp;\|&nbsp;undefind | 如果指定的键存在于缓冲区中,则返回与键关联的值;否则返回undefined。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.get(2); var result = pro.get(2);
...@@ -843,18 +843,18 @@ put(key: K,value: V): V ...@@ -843,18 +843,18 @@ put(key: K,value: V): V
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要添加的密钥。 | | key | K | 是 | 要添加的密钥。 |
| value | V | 是 | 指示与要添加的键关联的值。 | | value | V | 是 | 指示与要添加的键关联的值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 | | V | 返回与添加的键关联的值;如果要添加的键已经存在,则返回原始值,如果键或值为空,则抛出此异常。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.put(2,10); var result = pro.put(2,10);
``` ```
...@@ -869,12 +869,12 @@ values(): V[] ...@@ -869,12 +869,12 @@ values(): V[]
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 | | V&nbsp;[] | 按从最近访问到最近最少访问的顺序返回当前缓冲区中所有值的列表。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
pro.put(2,"anhu"); pro.put(2,"anhu");
...@@ -892,12 +892,12 @@ keys(): K[] ...@@ -892,12 +892,12 @@ keys(): K[]
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| K&nbsp;[] | 按升序返回当前缓冲区中所有键的列表,从最近访问到最近最少访问。 | | K&nbsp;[] | 按升序返回当前缓冲区中所有键的列表,从最近访问到最近最少访问。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.keys(); var result = pro.keys();
...@@ -913,17 +913,17 @@ remove(key: K): V | undefined ...@@ -913,17 +913,17 @@ remove(key: K): V | undefined
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 要删除的密钥。 | | key | K | 是 | 要删除的密钥。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V&nbsp;\|&nbsp;undefind | 返回一个包含已删除键值对的Optional对象;如果key不存在,则返回一个空的Optional对象,如果key为null,则抛出异常。 | | V&nbsp;\|&nbsp;undefind | 返回一个包含已删除键值对的Optional对象;如果key不存在,则返回一个空的Optional对象,如果key为null,则抛出异常。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.remove(20); var result = pro.remove(20);
...@@ -939,15 +939,15 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void ...@@ -939,15 +939,15 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| isEvict | boolean | 否 | 因容量不足而调用该方法时,参数值为true,其他情况为false。 | | isEvict | boolean | 否 | 因容量不足而调用该方法时,参数值为true,其他情况为false。 |
| key | K | 是 | 表示删除的键。 | | key | K | 是 | 表示删除的键。 |
| value | V | 是 | 表示删除的值。 | | value | V | 是 | 表示删除的值。 |
| newValue | V | 否 | 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 | | newValue | V | 否 | 如果已调用put方法并且要添加的键已经存在,则参数值是关联的新值。其他情况下参数值为空。 |
**示例:** **示例:**
``` ```js
var arr = []; var arr = [];
class ChildLruBuffer extends util.LruBuffer class ChildLruBuffer extends util.LruBuffer
{ {
...@@ -984,17 +984,17 @@ contains(key: K): boolean ...@@ -984,17 +984,17 @@ contains(key: K): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 表示要检查的键。 | | key | K | 是 | 表示要检查的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果缓冲区包含指定的键,则返回&nbsp;true。 | | boolean | 如果缓冲区包含指定的键,则返回&nbsp;true。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.contains(20); var result = pro.contains(20);
...@@ -1010,17 +1010,17 @@ createDefault(key: K): V ...@@ -1010,17 +1010,17 @@ createDefault(key: K): V
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | K | 是 | 表示丢失的键。 | | key | K | 是 | 表示丢失的键。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| V | 返回与键关联的值。 | | V | 返回与键关联的值。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
var result = pro.createDefault(50); var result = pro.createDefault(50);
``` ```
...@@ -1035,12 +1035,12 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1035,12 +1035,12 @@ entries(): IterableIterator&lt;[K,V]&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | 返回一个可迭代数组。 | | [K,&nbsp;V] | 返回一个可迭代数组。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro.entries(); var result = pro.entries();
...@@ -1056,12 +1056,12 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1056,12 +1056,12 @@ entries(): IterableIterator&lt;[K,V]&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [K,&nbsp;V] | 返回一个键值对形式的二维数组。 | | [K,&nbsp;V] | 返回一个键值对形式的二维数组。 |
**示例:** **示例:**
``` ```js
var pro = new util.LruBuffer(); var pro = new util.LruBuffer();
pro.put(2,10); pro.put(2,10);
var result = pro[symbol.iterator](); var result = pro[symbol.iterator]();
...@@ -1076,7 +1076,7 @@ entries(): IterableIterator&lt;[K,V]&gt; ...@@ -1076,7 +1076,7 @@ entries(): IterableIterator&lt;[K,V]&gt;
用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。 用于表示范围中的值的类型。该类型的值,类型可以为ScopeComparable或number。
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。 ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
``` ```js
interface ScopeComparable{ interface ScopeComparable{
compareTo(other: ScopeComparable): boolean; compareTo(other: ScopeComparable): boolean;
} }
...@@ -1088,7 +1088,7 @@ type ScopeType = ScopeComparable | number; ...@@ -1088,7 +1088,7 @@ type ScopeType = ScopeComparable | number;
示例: 示例:
``` ```js
class Temperature{ class Temperature{
constructor(value){ constructor(value){
this._temp = value; this._temp = value;
...@@ -1115,13 +1115,13 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType) ...@@ -1115,13 +1115,13 @@ constructor(lowerObj: ScopeType, upperObj: ScopeType)
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 指定作用域实例的上限。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1137,12 +1137,12 @@ toString(): string ...@@ -1137,12 +1137,12 @@ toString(): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回包含当前范围对象的字符串表示形式。 | | string | 返回包含当前范围对象的字符串表示形式。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1159,17 +1159,17 @@ intersect(range: Scope): Scope ...@@ -1159,17 +1159,17 @@ intersect(range: Scope): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回给定范围和当前范围的交集。 | | [Scope](#scope8) | 返回给定范围和当前范围的交集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1189,18 +1189,18 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1189,18 +1189,18 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回当前范围与给定下限和上限范围的交集。 | | [Scope](#scope8) | 返回当前范围与给定下限和上限范围的交集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1220,12 +1220,12 @@ getUpper(): ScopeType ...@@ -1220,12 +1220,12 @@ getUpper(): ScopeType
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 返回当前范围的上限值。 | | [ScopeType](#scopetype8) | 返回当前范围的上限值。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1242,12 +1242,12 @@ getLower(): ScopeType ...@@ -1242,12 +1242,12 @@ getLower(): ScopeType
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 返回当前范围的下限值。 | | [ScopeType](#scopetype8) | 返回当前范围的下限值。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1264,18 +1264,19 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope ...@@ -1264,18 +1264,19 @@ expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 | | lowerObj | [ScopeType](#scopetype8) | 是 | 给定范围的下限。 |
| upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 | | upperObj | [ScopeType](#scopetype8) | 是 | 给定范围的上限。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回当前范围和给定下限和上限的并集。 | | [Scope](#scope8) | 返回当前范围和给定下限和上限的并集。 |
**示例:** **示例:**
```
```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1294,17 +1295,17 @@ expand(range: Scope): Scope ...@@ -1294,17 +1295,17 @@ expand(range: Scope): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回包括当前范围和给定范围的并集。 | | [Scope](#scope8) | 返回包括当前范围和给定范围的并集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1324,17 +1325,17 @@ expand(value: ScopeType): Scope ...@@ -1324,17 +1325,17 @@ expand(value: ScopeType): Scope
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [Scope](#scope8) | 返回包括当前范围和给定值的并集。 | | [Scope](#scope8) | 返回包括当前范围和给定值的并集。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1352,17 +1353,17 @@ contains(value: ScopeType): boolean ...@@ -1352,17 +1353,17 @@ contains(value: ScopeType): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入一个给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定值包含在当前范围内返回true,否则返回false。 | | boolean | 如果给定值包含在当前范围内返回true,否则返回false。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1380,17 +1381,17 @@ contains(range: Scope): boolean ...@@ -1380,17 +1381,17 @@ contains(range: Scope): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| range | [Scope](#scope8) | 是 | 传入一个给定范围。 | | range | [Scope](#scope8) | 是 | 传入一个给定范围。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 如果给定范围包含在当前范围内返回true,否则返回false。 | | boolean | 如果给定范围包含在当前范围内返回true,否则返回false。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var range = new util.Scope(tempLower, tempUpper); var range = new util.Scope(tempLower, tempUpper);
...@@ -1410,17 +1411,17 @@ clamp(value: ScopeType): ScopeType ...@@ -1410,17 +1411,17 @@ clamp(value: ScopeType): ScopeType
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | [ScopeType](#scopetype8) | 是 | 传入的给定值。 | | value | [ScopeType](#scopetype8) | 是 | 传入的给定值。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 | | [ScopeType](#scopetype8) | 如果传入的value小于下限,则返回lowerObj;如果大于上限值则返回upperObj;如果在当前范围内,则返回value。 |
**示例:** **示例:**
``` ```js
var tempLower = new Temperature(30); var tempLower = new Temperature(30);
var tempUpper = new Temperature(40); var tempUpper = new Temperature(40);
var tempMiDF = new Temperature(35); var tempMiDF = new Temperature(35);
...@@ -1441,7 +1442,7 @@ Base64的构造函数。 ...@@ -1441,7 +1442,7 @@ Base64的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var base64 = new util.Base64(); var base64 = new util.Base64();
``` ```
...@@ -1455,17 +1456,17 @@ encodeSync(src: Uint8Array): Uint8Array ...@@ -1455,17 +1456,17 @@ encodeSync(src: Uint8Array): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 编码输入Uint8数组。 | | src | Uint8Array | 是 | 编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回编码后新分配的Uint8数组。 | | Uint8Array | 返回编码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeSync(array); var result = that.encodeSync(array);
...@@ -1481,17 +1482,17 @@ encodeToStringSync(src: Uint8Array): string ...@@ -1481,17 +1482,17 @@ encodeToStringSync(src: Uint8Array): string
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 编码输入Uint8数组。 | | src | Uint8Array | 是 | 编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| string | 返回编码后的字符串。 | | string | 返回编码后的字符串。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var result = that.encodeToStringSync(array); var result = that.encodeToStringSync(array);
...@@ -1507,17 +1508,17 @@ decodeSync(src: Uint8Array | string): Uint8Array ...@@ -1507,17 +1508,17 @@ decodeSync(src: Uint8Array | string): Uint8Array
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | 是 | 解码输入Uint8数组或者字符串。 | | src | Uint8Array&nbsp;\|&nbsp;string | 是 | 解码输入Uint8数组或者字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Uint8Array | 返回解码后新分配的Uint8数组。 | | Uint8Array | 返回解码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var buff = 'czEz'; var buff = 'czEz';
var result = that.decodeSync(buff); var result = that.decodeSync(buff);
...@@ -1533,17 +1534,17 @@ encode(src: Uint8Array): Promise&lt;Uint8Array&gt; ...@@ -1533,17 +1534,17 @@ encode(src: Uint8Array): Promise&lt;Uint8Array&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 异步编码输入Uint8数组。 | | src | Uint8Array | 是 | 异步编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | 返回异步编码后新分配的Uint8数组。 | | Promise&lt;Uint8Array&gt; | 返回异步编码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
var rarray = new Uint8Array([99,122,69,122]); var rarray = new Uint8Array([99,122,69,122]);
...@@ -1564,17 +1565,17 @@ encodeToString(src: Uint8Array): Promise&lt;string&gt; ...@@ -1564,17 +1565,17 @@ encodeToString(src: Uint8Array): Promise&lt;string&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array | 是 | 异步编码输入Uint8数组。 | | src | Uint8Array | 是 | 异步编码输入Uint8数组。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | 返回异步编码后的字符串。 | | Promise&lt;string&gt; | 返回异步编码后的字符串。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([115,49,51]); var array = new Uint8Array([115,49,51]);
that.encodeToString(array).then(val=>{ that.encodeToString(array).then(val=>{
...@@ -1592,17 +1593,17 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt; ...@@ -1592,17 +1593,17 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| src | Uint8Array&nbsp;\|&nbsp;string | 是 | 异步解码输入Uint8数组或者字符串。 | | src | Uint8Array&nbsp;\|&nbsp;string | 是 | 异步解码输入Uint8数组或者字符串。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| Promise&lt;Uint8Array&gt; | 返回异步解码后新分配的Uint8数组。 | | Promise&lt;Uint8Array&gt; | 返回异步解码后新分配的Uint8数组。 |
**示例:** **示例:**
``` ```js
var that = new util.Base64(); var that = new util.Base64();
var array = new Uint8Array([99,122,69,122]); var array = new Uint8Array([99,122,69,122]);
var rarray = new Uint8Array([115,49,51]); var rarray = new Uint8Array([115,49,51]);
...@@ -1614,7 +1615,7 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt; ...@@ -1614,7 +1615,7 @@ decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
``` ```
## Types<sup>8+</sup> ## types<sup>8+</sup>
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
...@@ -1626,8 +1627,8 @@ Types的构造函数。 ...@@ -1626,8 +1627,8 @@ Types的构造函数。
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**示例:** **示例:**
``` ```js
var type = new util.Types(); var type = new util.types();
``` ```
...@@ -1640,18 +1641,18 @@ isAnyArrayBuffer(value: Object): boolean ...@@ -1640,18 +1641,18 @@ isAnyArrayBuffer(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 | | boolean | 判断的结果,如果是ArrayBuffer类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isAnyArrayBuffer(new ArrayBuffer([])); var result = that.isAnyArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1667,18 +1668,18 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A ...@@ -1667,18 +1668,18 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的ArrayBufferView辅助类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isArrayBufferView(new Int8Array([])); var result = that.isArrayBufferView(new Int8Array([]));
``` ```
...@@ -1692,18 +1693,18 @@ isArgumentsObject(value: Object): boolean ...@@ -1692,18 +1693,18 @@ isArgumentsObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的arguments类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
function foo() { function foo() {
var result = that.isArgumentsObject(arguments); var result = that.isArgumentsObject(arguments);
} }
...@@ -1720,18 +1721,18 @@ isArrayBuffer(value: Object): boolean ...@@ -1720,18 +1721,18 @@ isArrayBuffer(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的ArrayBuffer类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isArrayBuffer(new ArrayBuffer([])); var result = that.isArrayBuffer(new ArrayBuffer([]));
``` ```
...@@ -1745,18 +1746,18 @@ isAsyncFunction(value: Object): boolean ...@@ -1745,18 +1746,18 @@ isAsyncFunction(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的异步函数类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isAsyncFunction(async function foo() {}); var result = that.isAsyncFunction(async function foo() {});
``` ```
...@@ -1770,18 +1771,18 @@ isBooleanObject(value: Object): boolean ...@@ -1770,18 +1771,18 @@ isBooleanObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Boolean对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isBooleanObject(new Boolean(true)); var result = that.isBooleanObject(new Boolean(true));
``` ```
...@@ -1795,18 +1796,18 @@ isBoxedPrimitive(value: Object): boolean ...@@ -1795,18 +1796,18 @@ isBoxedPrimitive(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Boolean或Number或String或Symbol对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isBoxedPrimitive(new Boolean(false)); var result = that.isBoxedPrimitive(new Boolean(false));
``` ```
...@@ -1820,18 +1821,18 @@ isDataView(value: Object): boolean ...@@ -1820,18 +1821,18 @@ isDataView(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的DataView对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const ab = new ArrayBuffer(20); const ab = new ArrayBuffer(20);
var result = that.isDataView(new DataView(ab)); var result = that.isDataView(new DataView(ab));
``` ```
...@@ -1846,18 +1847,18 @@ isDate(value: Object): boolean ...@@ -1846,18 +1847,18 @@ isDate(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Date对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isDate(new Date()); var result = that.isDate(new Date());
``` ```
...@@ -1871,18 +1872,18 @@ isExternal(value: Object): boolean ...@@ -1871,18 +1872,18 @@ isExternal(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含native&nbsp;External类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含native&nbsp;External类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const data = util.createExternalType(); const data = util.createExternalType();
var result = that.isExternal(data); var result = that.isExternal(data);
``` ```
...@@ -1897,18 +1898,18 @@ isFloat32Array(value: Object): boolean ...@@ -1897,18 +1898,18 @@ isFloat32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Float32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isFloat32Array(new Float32Array()); var result = that.isFloat32Array(new Float32Array());
``` ```
...@@ -1922,18 +1923,18 @@ isFloat64Array(value: Object): boolean ...@@ -1922,18 +1923,18 @@ isFloat64Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Float64Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isFloat64Array(new Float64Array()); var result = that.isFloat64Array(new Float64Array());
``` ```
...@@ -1947,18 +1948,18 @@ isGeneratorFunction(value: Object): boolean ...@@ -1947,18 +1948,18 @@ isGeneratorFunction(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的generator函数类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isGeneratorFunction(function* foo() {}); var result = that.isGeneratorFunction(function* foo() {});
``` ```
...@@ -1972,18 +1973,18 @@ isGeneratorObject(value: Object): boolean ...@@ -1972,18 +1973,18 @@ isGeneratorObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的generator对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
function* foo() {} function* foo() {}
const generator = foo(); const generator = foo();
var result = that.isGeneratorObject(generator); var result = that.isGeneratorObject(generator);
...@@ -1999,18 +2000,18 @@ isInt8Array(value: Object): boolean ...@@ -1999,18 +2000,18 @@ isInt8Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int8Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isInt8Array(new Int8Array([])); var result = that.isInt8Array(new Int8Array([]));
``` ```
...@@ -2024,18 +2025,18 @@ isInt16Array(value: Object): boolean ...@@ -2024,18 +2025,18 @@ isInt16Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int16Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isInt16Array(new Int16Array([])); var result = that.isInt16Array(new Int16Array([]));
``` ```
...@@ -2049,18 +2050,18 @@ isInt32Array(value: Object): boolean ...@@ -2049,18 +2050,18 @@ isInt32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Int32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isInt32Array(new Int32Array([])); var result = that.isInt32Array(new Int32Array([]));
``` ```
...@@ -2074,18 +2075,18 @@ isMap(value: Object): boolean ...@@ -2074,18 +2075,18 @@ isMap(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Map类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isMap(new Map()); var result = that.isMap(new Map());
``` ```
...@@ -2099,18 +2100,18 @@ isMapIterator(value: Object): boolean ...@@ -2099,18 +2100,18 @@ isMapIterator(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Map的Iterator类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const map = new Map(); const map = new Map();
var result = that.isMapIterator(map.keys()); var result = that.isMapIterator(map.keys());
``` ```
...@@ -2125,18 +2126,18 @@ isNativeError(value: Object): boolean ...@@ -2125,18 +2126,18 @@ isNativeError(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Error类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isNativeError(new TypeError()); var result = that.isNativeError(new TypeError());
``` ```
...@@ -2150,18 +2151,18 @@ isNumberObject(value: Object): boolean ...@@ -2150,18 +2151,18 @@ isNumberObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Number对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isNumberObject(new Number(0)); var result = that.isNumberObject(new Number(0));
``` ```
...@@ -2175,18 +2176,18 @@ isPromise(value: Object): boolean ...@@ -2175,18 +2176,18 @@ isPromise(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Promise类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isPromise(Promise.resolve(1)); var result = that.isPromise(Promise.resolve(1));
``` ```
...@@ -2200,18 +2201,18 @@ isProxy(value: Object): boolean ...@@ -2200,18 +2201,18 @@ isProxy(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Proxy类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const target = {}; const target = {};
const proxy = new Proxy(target, {}); const proxy = new Proxy(target, {});
var result = that.isProxy(proxy); var result = that.isProxy(proxy);
...@@ -2227,18 +2228,18 @@ isRegExp(value: Object): boolean ...@@ -2227,18 +2228,18 @@ isRegExp(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的RegExp类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isRegExp(new RegExp('abc')); var result = that.isRegExp(new RegExp('abc'));
``` ```
...@@ -2252,18 +2253,18 @@ isSet(value: Object): boolean ...@@ -2252,18 +2253,18 @@ isSet(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Set类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isSet(new Set()); var result = that.isSet(new Set());
``` ```
...@@ -2277,18 +2278,18 @@ isSetIterator(value: Object): boolean ...@@ -2277,18 +2278,18 @@ isSetIterator(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Set的Iterator类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const set = new Set(); const set = new Set();
var result = that.isSetIterator(set.keys()); var result = that.isSetIterator(set.keys());
``` ```
...@@ -2303,18 +2304,18 @@ isStringObject(value: Object): boolean ...@@ -2303,18 +2304,18 @@ isStringObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的String对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isStringObject(new String('foo')); var result = that.isStringObject(new String('foo'));
``` ```
...@@ -2328,18 +2329,18 @@ isSymbolObject(value: Object): boolean ...@@ -2328,18 +2329,18 @@ isSymbolObject(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Symbol对象类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
const symbols = Symbol('foo'); const symbols = Symbol('foo');
var result = that.isSymbolObject(Object(symbols)); var result = that.isSymbolObject(Object(symbols));
``` ```
...@@ -2356,18 +2357,18 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui ...@@ -2356,18 +2357,18 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的TypedArray包含的类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isTypedArray(new Float64Array([])); var result = that.isTypedArray(new Float64Array([]));
``` ```
...@@ -2381,18 +2382,18 @@ isUint8Array(value: Object): boolean ...@@ -2381,18 +2382,18 @@ isUint8Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint8Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isUint8Array(new Uint8Array([])); var result = that.isUint8Array(new Uint8Array([]));
``` ```
...@@ -2406,18 +2407,18 @@ isUint8ClampedArray(value: Object): boolean ...@@ -2406,18 +2407,18 @@ isUint8ClampedArray(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint8ClampedArray数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isUint8ClampedArray(new Uint8ClampedArray([])); var result = that.isUint8ClampedArray(new Uint8ClampedArray([]));
``` ```
...@@ -2431,18 +2432,18 @@ isUint16Array(value: Object): boolean ...@@ -2431,18 +2432,18 @@ isUint16Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint16Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isUint16Array(new Uint16Array([])); var result = that.isUint16Array(new Uint16Array([]));
``` ```
...@@ -2456,18 +2457,18 @@ isUint32Array(value: Object): boolean ...@@ -2456,18 +2457,18 @@ isUint32Array(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的Uint32Array数组类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isUint32Array(new Uint32Array([])); var result = that.isUint32Array(new Uint32Array([]));
``` ```
...@@ -2481,18 +2482,18 @@ isWeakMap(value: Object): boolean ...@@ -2481,18 +2482,18 @@ isWeakMap(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的WeakMap类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isWeakMap(new WeakMap()); var result = that.isWeakMap(new WeakMap());
``` ```
...@@ -2506,17 +2507,17 @@ isWeakSet(value: Object): boolean ...@@ -2506,17 +2507,17 @@ isWeakSet(value: Object): boolean
**系统能力:** SystemCapability.Utils.Lang **系统能力:** SystemCapability.Utils.Lang
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | Object | 是 | 待检测对象。 | | value | Object | 是 | 待检测对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | -------- | -------- |
| boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 | | boolean | 判断的结果,如果是内置包含的WeakSet类型为true,反之为false。 |
**示例:** **示例:**
``` ```js
var that = new util.Types(); var that = new util.types();
var result = that.isWeakSet(new WeakSet()); var result = that.isWeakSet(new WeakSet());
``` ```
...@@ -235,18 +235,20 @@ create(id: string, type: WindowType): Promise&lt;Window&gt; ...@@ -235,18 +235,20 @@ create(id: string, type: WindowType): Promise&lt;Window&gt;
create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): void
当Context为[ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md)时,创建系统窗口,使用callback方式作为异步方法。 创建子窗口,使用callback方式作为异步方法,其中Context详见[Context](js-apis-Context.md)
从API version 9开始,当Context为[ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md)时,创建系统窗口,使用callback方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core **系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ---------------------- | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | [Context](js-apis-serviceExtAbilityContext.md) | 是 | 当前应用上下文信息。 | | ctx | Context | 是 | 当前应用上下文信息。<br>API version 8的Context定义见[Context](js-apis-Context.md)<br>API version 9的Context定义见[Context](js-apis-serviceExtAbilityContext.md) |
| id | string | 是 | 窗口id。 | | id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 | | type | [WindowType](#windowtype) | 是 | 窗口类型。 |
| callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前窗口对象。 | | callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前窗口对象。 |
- 示例 - 示例
...@@ -267,17 +269,19 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Wi ...@@ -267,17 +269,19 @@ create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback&lt;Wi
create(ctx: Context, id: string, type: WindowType): Promise&lt;Window&gt; create(ctx: Context, id: string, type: WindowType): Promise&lt;Window&gt;
当Context为[ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md)时,创建系统窗口,使用Promise方式作为异步方法。 创建子窗口,使用Promise方式作为异步方法,其中Context详见[Context](js-apis-Context.md)
从API version 9开始,当Context为[ServiceExtAbilityContext](js-apis-serviceExtAbilityContext.md)时,创建系统窗口,使用Promise方式作为异步方法。
**系统能力**:SystemCapability.WindowManager.WindowManager.Core **系统能力**:SystemCapability.WindowManager.WindowManager.Core
- 参数 - 参数
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------------------------------------- | ---- | -------------------- | | ------ | ------------------------- | ---- | ------------------------------------------------------------ |
| ctx | [Context](js-apis-serviceExtAbilityContext.md) | 是 | 当前应用上下文信息。 | | ctx | Context | 是 | 当前应用上下文信息。<br/>API version 8的Context定义见[Context](js-apis-Context.md)<br/>API version 9的Context定义见[Context](js-apis-serviceExtAbilityContext.md)。 |
| id | string | 是 | 窗口id。 | | id | string | 是 | 窗口id。 |
| type | [WindowType](#windowtype) | 是 | 窗口类型。 | | type | [WindowType](#windowtype) | 是 | 窗口类型。 |
- 返回值 - 返回值
...@@ -427,7 +431,7 @@ getTopWindow(ctx: Context, callback: AsyncCallback&lt;Window&gt;): void ...@@ -427,7 +431,7 @@ getTopWindow(ctx: Context, callback: AsyncCallback&lt;Window&gt;): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。API 8的Context定义见[Context](js-apis-Context.md)。API 9的Context定义见[Context](js-apis-ability-context.md)。 | | ctx | Context | 是 | 当前应用上下文信息。<br>API version 8的Context定义见[Context](js-apis-Context.md)<br>API version 9的Context定义见[Context](js-apis-ability-context.md)。 |
| callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前应用内最后显示的窗口对象。 | | callback | AsyncCallback&lt;[Window](#window)&gt; | 是 | 回调返回当前应用内最后显示的窗口对象。 |
- 示例 - 示例
...@@ -456,7 +460,7 @@ getTopWindow(ctx: Context): Promise&lt;Window&gt; ...@@ -456,7 +460,7 @@ getTopWindow(ctx: Context): Promise&lt;Window&gt;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------- | ---- | ------------------------------------------------------------ | | ------ | ------- | ---- | ------------------------------------------------------------ |
| ctx | Context | 是 | 当前应用上下文信息。API8的Context定义见[Context](js-apis-Context.md)。API 9的Context定义见[Context](js-apis-ability-context.md)。 | | ctx | Context | 是 | 当前应用上下文信息。<br/>API version 8的Context定义见[Context](js-apis-Context.md)<br/>API version 9的Context定义见[Context](js-apis-ability-context.md)。 |
- 返回值 - 返回值
......
...@@ -25,14 +25,14 @@ XmlSerializer的构造函数。 ...@@ -25,14 +25,14 @@ XmlSerializer的构造函数。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ----------------------------------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 用于接收写入xml信息的ArrayBuffer或DataView内存。 | | buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 用于接收写入xml信息的ArrayBuffer或DataView内存。 |
| encoding | string | 否 | 编码格式。 | | encoding | string | 否 | 编码格式。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var bufView = new DataView(arrayBuffer); var bufView = new DataView(arrayBuffer);
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
...@@ -47,14 +47,14 @@ setAttributes(name: string, value: string): void ...@@ -47,14 +47,14 @@ setAttributes(name: string, value: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ---------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 属性的key值。 | | name | string | 是 | 属性的key值。 |
| value | string | 是 | 属性的value值。 | | value | string | 是 | 属性的value值。 |
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
``` ```
...@@ -68,14 +68,14 @@ addEmptyElement(name: string): void ...@@ -68,14 +68,14 @@ addEmptyElement(name: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | --------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 该空元素的元素名。 | | name | string | 是 | 该空元素的元素名。 |
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.addEmptyElement("b"); // => <b/> thatSer.addEmptyElement("b"); // => <b/>
``` ```
...@@ -88,7 +88,7 @@ setDeclaration(): void ...@@ -88,7 +88,7 @@ setDeclaration(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>; thatSer.setDeclaration() // => <?xml version="1.0" encoding="utf-8"?>;
``` ```
...@@ -102,13 +102,13 @@ startElement(name: string): void ...@@ -102,13 +102,13 @@ startElement(name: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | --------- | | -------- | -------- | -------- | -------- |
| name | string | 是 | 当前元素的元素名。 | | name | string | 是 | 当前元素的元素名。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("notel"); thatSer.startElement("notel");
...@@ -124,7 +124,7 @@ endElement(): void ...@@ -124,7 +124,7 @@ endElement(): void
**示例:** **示例:**
``` ```js
var thatSer = new xml.XmlSerializer(bufView); var thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "http://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
...@@ -142,14 +142,14 @@ setNamespace(prefix: string, namespace: string): void ...@@ -142,14 +142,14 @@ setNamespace(prefix: string, namespace: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | --------------- | | -------- | -------- | -------- | -------- |
| prefix | string | 是 | 当前元素及其子元素的前缀。 | | prefix | string | 是 | 当前元素及其子元素的前缀。 |
| namespace | string | 是 | 当前元素及其子元素的命名空间。 | | namespace | string | 是 | 当前元素及其子元素的命名空间。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
...@@ -166,13 +166,13 @@ setComment(text: string): void ...@@ -166,13 +166,13 @@ setComment(text: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ---------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | 当前元素的注释内容。 | | text | string | 是 | 当前元素的注释内容。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -189,13 +189,13 @@ setCDATA(text: string): void ...@@ -189,13 +189,13 @@ setCDATA(text: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ----------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | CDATA属性的内容。 | | text | string | 是 | CDATA属性的内容。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1028); var arrayBuffer = new ArrayBuffer(1028);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>'; thatSer.setCDATA('root SYSTEM') // => '<![CDATA[root SYSTEM]]>';
...@@ -210,13 +210,13 @@ setText(text: string): void ...@@ -210,13 +210,13 @@ setText(text: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ---------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | text属性的内容。 | | text | string | 是 | text属性的内容。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
...@@ -234,13 +234,13 @@ setDocType(text: string): void ...@@ -234,13 +234,13 @@ setDocType(text: string): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ------ | ---- | ------------- | | -------- | -------- | -------- | -------- |
| text | string | 是 | DocType属性的内容。 | | text | string | 是 | DocType属性的内容。 |
**示例:** **示例:**
``` ```js
var arrayBuffer = new ArrayBuffer(1024); var arrayBuffer = new ArrayBuffer(1024);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>'; thatSer.setDocType('root SYSTEM'); // => '<!DOCTYPE root SYSTEM>';
...@@ -258,14 +258,14 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string) ...@@ -258,14 +258,14 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------------- | | -------- | -------- | -------- | -------- |
| buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 | | buffer | ArrayBuffer&nbsp;\|&nbsp;DataView | 是 | 含有xml文本信息的ArrayBuffer或者DataView。 |
| encoding | string | 否 | 编码格式(仅支持utf-8)。 | | encoding | string | 否 | 编码格式(仅支持utf-8)。 |
**示例:** **示例:**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -291,13 +291,13 @@ parse(option: ParseOptions): void ...@@ -291,13 +291,13 @@ parse(option: ParseOptions): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | ---------------- | | -------- | -------- | -------- | -------- |
| option | [ParseOptions](#parseoptions) | 是 | 用户控制以及获取解析信息的选项。 | | option | [ParseOptions](#parseoptions) | 是 | 用户控制以及获取解析信息的选项。 |
**示例:** **示例:**
``` ```js
var strXml = var strXml =
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' + '<note importance="high" logged="true">' +
...@@ -330,13 +330,13 @@ that.parse(options); ...@@ -330,13 +330,13 @@ that.parse(options);
xml解析选项。 xml解析选项。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| ------------------------------ | ---------------------------------------- | ---- | -------------------------------- | | -------- | -------- | -------- | -------- |
| supportDoctype | boolean | 否 | 是否忽略Doctype&nbsp;,&nbsp;默认false。 | | supportDoctype | boolean | 否 | 是否忽略Doctype&nbsp;,&nbsp;默认false。 |
| ignoreNameSpace | boolean | 否 | 是否忽略NameSpace,默认false。 | | ignoreNameSpace | boolean | 否 | 是否忽略NameSpace,默认false。 |
| tagValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取tagValue回调函数。 | | tagValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取tagValue回调函数。 |
| attributeValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取attributeValue回调函数。 | | attributeValueCallbackFunction | (name:&nbsp;string,&nbsp;value:&nbsp;string)=&gt;&nbsp;boolean | 否 | 获取attributeValue回调函数。 |
| tokenValueCallbackFunction | (eventType:&nbsp;[EventType](#eventtype),&nbsp;value:&nbsp;[ParseInfo](#parseinfo))=&gt;&nbsp;boolean | 否 | 获取tokenValue回调函数。 | | tokenValueCallbackFunction | (eventType:&nbsp;[EventType](#eventtype),&nbsp;value:&nbsp;[ParseInfo](#parseinfo))=&gt;&nbsp;boolean | 否 | 获取tokenValue回调函数。 |
## ParseInfo ## ParseInfo
...@@ -351,8 +351,8 @@ getColumnNumber(): number ...@@ -351,8 +351,8 @@ getColumnNumber(): number
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ------- | | -------- | -------- |
| number | 返回当前列号。 | | number | 返回当前列号。 |
...@@ -364,8 +364,8 @@ getDepth(): number ...@@ -364,8 +364,8 @@ getDepth(): number
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ---------- | | -------- | -------- |
| number | 返回元素的当前深度。 | | number | 返回元素的当前深度。 |
...@@ -377,8 +377,8 @@ getLineNumber(): number ...@@ -377,8 +377,8 @@ getLineNumber(): number
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ------- | | -------- | -------- |
| number | 返回当前行号。 | | number | 返回当前行号。 |
...@@ -390,8 +390,8 @@ getName(): string ...@@ -390,8 +390,8 @@ getName(): string
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | --------- | | -------- | -------- |
| string | 返回当前元素名称。 | | string | 返回当前元素名称。 |
...@@ -403,8 +403,8 @@ getNamespace(): string ...@@ -403,8 +403,8 @@ getNamespace(): string
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ------------ | | -------- | -------- |
| string | 返回当前元素的命名空间。 | | string | 返回当前元素的命名空间。 |
...@@ -416,8 +416,8 @@ getPrefix(): string ...@@ -416,8 +416,8 @@ getPrefix(): string
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | --------- | | -------- | -------- |
| string | 返回当前元素前缀。 | | string | 返回当前元素前缀。 |
...@@ -429,8 +429,8 @@ getText(): string ...@@ -429,8 +429,8 @@ getText(): string
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ------------ | | -------- | -------- |
| string | 返回当前事件的文本内容。 | | string | 返回当前事件的文本内容。 |
...@@ -442,8 +442,8 @@ isEmptyElementTag(): boolean ...@@ -442,8 +442,8 @@ isEmptyElementTag(): boolean
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------- | ---------------- | | -------- | -------- |
| boolean | 返回true,当前元素为空元素。 | | boolean | 返回true,当前元素为空元素。 |
...@@ -455,8 +455,8 @@ isWhitespace(): boolean ...@@ -455,8 +455,8 @@ isWhitespace(): boolean
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------- | --------------------- | | -------- | -------- |
| boolean | 返回true,当前文本事件仅包含空格字符。 | | boolean | 返回true,当前文本事件仅包含空格字符。 |
...@@ -467,8 +467,8 @@ getAttributeCount(): number ...@@ -467,8 +467,8 @@ getAttributeCount(): number
获取当前开始标记的属性数。 获取当前开始标记的属性数。
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------ | ----------- | | -------- | -------- |
| number | 当前开始标记的属性数。 | | number | 当前开始标记的属性数。 |
...@@ -476,16 +476,16 @@ getAttributeCount(): number ...@@ -476,16 +476,16 @@ getAttributeCount(): number
事件枚举。 事件枚举。
| 名称 | 枚举值 | 说明 | | 名称 | 枚举值 | 说明 |
| ---------------- | ---- | ------------ | | -------- | -------- | -------- |
| START_DOCUMENT | 0 | 启动文件事件。 | | START_DOCUMENT | 0 | 启动文件事件。 |
| END_DOCUMENT | 1 | 结束文件事件。 | | END_DOCUMENT | 1 | 结束文件事件。 |
| START_TAG | 2 | 启动标签事件。 | | START_TAG | 2 | 启动标签事件。 |
| END_TAG | 3 | 结束标签事件。 | | END_TAG | 3 | 结束标签事件。 |
| TEXT | 4 | 文本事件。 | | TEXT | 4 | 文本事件。 |
| CDSECT | 5 | CDATA事件。 | | CDSECT | 5 | CDATA事件。 |
| COMMENT | 6 | XML注释事件。 | | COMMENT | 6 | XML注释事件。 |
| DOCDECL | 7 | XML文档类型声明事件。 | | DOCDECL | 7 | XML文档类型声明事件。 |
| INSTRUCTION | 8 | XML处理指令声明事件。 | | INSTRUCTION | 8 | XML处理指令声明事件。 |
| ENTITY_REFERENCE | 9 | 实体引用事件。 | | ENTITY_REFERENCE | 9 | 实体引用事件。 |
| WHITESPACE | 10 | 空白事件。 | | WHITESPACE | 10 | 空白事件。 |
# WebGL # WebGL
- [概述](webgl-overview.md) - [WebGL开发概述](webgl-overview.md)
- [WebGL开发指导](webgl-guidelines.md) - [WebGL开发指导](webgl-guidelines.md)
...@@ -14,15 +14,22 @@ ...@@ -14,15 +14,22 @@
- [SysCap说明](quick-start/syscap.md) - [SysCap说明](quick-start/syscap.md)
- 开发 - 开发
- Ability开发 - Ability开发
- [FA模型综述](ability/fa-brief.md) - [Ability框架概述](ability/ability-brief.md)
- [PageAbility开发指导](ability/fa-pageability.md) - FA模型
- [ServiceAbility开发指导](ability/fa-serviceability.md) - [FA模型综述](ability/fa-brief.md)
- [DataAbility开发指导](ability/fa-dataability.md) - [PageAbility开发指导](ability/fa-pageability.md)
- [FA卡片开发指导](ability/fa-formability.md) - [ServiceAbility开发指导](ability/fa-serviceability.md)
- [DataAbility开发指导](ability/fa-dataability.md)
- [FormAbility开发指导](ability/fa-formability.md)
- Stage模型
- [Stage模型综述](ability/stage-brief.md)
- [Ability开发指导](ability/stage-ability.md)
- [ServiceExtensionAbility开发指导](ability/stage-serviceextension.md)
- [FormExtensionAbility开发指导](ability/stage-formextension.md)
- [应用迁移开发指导](ability/stage-ability-continuation.md)
- 其他 - 其他
- [WantAgent使用指导](ability/wantagent.md) - [WantAgent使用指导](ability/wantagent.md)
- [Ability助手使用指导](ability/ability-assistant-guidelines.md) - [Ability助手使用指导](ability/ability-assistant-guidelines.md)
- [测试框架使用指导](ability-delegator.md)
- UI开发 - UI开发
- [方舟开发框架(ArkUI)概述](ui/arkui-overview.md) - [方舟开发框架(ArkUI)概述](ui/arkui-overview.md)
- 基于JS扩展的类Web开发范式 - 基于JS扩展的类Web开发范式
...@@ -152,13 +159,13 @@ ...@@ -152,13 +159,13 @@
- [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md) - [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md)
- [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md) - [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md)
- [语法糖](ui/ts-syntactic-sugar.md) - [语法糖](ui/ts-syntactic-sugar.md)
- 常见组件开发指导 - 常见组件开发指导
- [Button开发指导](ui/ui-ts-basic-components-button.md) - [Button开发指导](ui/ui-ts-basic-components-button.md)
- [Web开发指导](ui/ui-ts-components-web.md) - [Web开发指导](ui/ui-ts-components-web.md)
- 常见布局开发指导 - 常见布局开发指导
- [弹性布局](ui/ui-ts-layout-flex.md) - [弹性布局](ui/ui-ts-layout-flex.md)
- [栅格布局](ui/ui-ts-layout-grid-container.md) - [栅格布局](ui/ui-ts-layout-grid-container.md)
- [媒体查询](ui/ui-ts-layout-mediaquery.md) - [媒体查询](ui/ui-ts-layout-mediaquery.md)
- 体验声明式UI - 体验声明式UI
- [创建声明式UI工程](ui/ui-ts-creating-project.md) - [创建声明式UI工程](ui/ui-ts-creating-project.md)
- [初识Component](ui/ui-ts-components.md) - [初识Component](ui/ui-ts-components.md)
...@@ -191,6 +198,7 @@ ...@@ -191,6 +198,7 @@
- [音频采集开发指导](media/audio-capturer.md) - [音频采集开发指导](media/audio-capturer.md)
- 视频 - 视频
- [视频播放开发指导](media/video-playback.md) - [视频播放开发指导](media/video-playback.md)
- [视频录制开发指导](media/video-recorder.md)
- 图片 - 图片
- [图片开发指导](media/image.md) - [图片开发指导](media/image.md)
- 安全 - 安全
......
...@@ -65,7 +65,7 @@ GPIO接口定义了操作GPIO管脚的标准方法集合,包括: ...@@ -65,7 +65,7 @@ GPIO接口定义了操作GPIO管脚的标准方法集合,包括:
<td class="cellrowborder" valign="top" width="47.9%" headers="mcps1.2.4.1.3 "><p id="p99693712113"><a name="p99693712113"></a><a name="p99693712113"></a>设置管脚对应的中断服务函数</p> <td class="cellrowborder" valign="top" width="47.9%" headers="mcps1.2.4.1.3 "><p id="p99693712113"><a name="p99693712113"></a><a name="p99693712113"></a>设置管脚对应的中断服务函数</p>
</td> </td>
</tr> </tr>
<tr id="row4969117172110"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p119692079215"><a name="p119692079215"></a><a name="p119692079215"></a>GpioUnSetIrq</p> <tr id="row4969117172110"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p119692079215"><a name="p119692079215"></a><a name="p119692079215"></a>GpioUnsetIrq</p>
</td> </td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1996916792114"><a name="p1996916792114"></a><a name="p1996916792114"></a>取消管脚对应的中断服务函数</p> <td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1996916792114"><a name="p1996916792114"></a><a name="p1996916792114"></a>取消管脚对应的中断服务函数</p>
</td> </td>
...@@ -245,7 +245,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ...@@ -245,7 +245,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
示例代码: 示例代码:
``` ```c
int32_t ret; int32_t ret;
uint16_t val; uint16_t val;
/* 将3号GPIO管脚配置为输出 */ /* 将3号GPIO管脚配置为输出 */
...@@ -326,76 +326,38 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ...@@ -326,76 +326,38 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
>![](../public_sys-resources/icon-caution.gif) **注意:** >![](../public_sys-resources/icon-caution.gif) **注意:**
>同一时间,只能为某个GPIO管脚设置一个中断服务函数,如果重复调用GpioSetIrq函数,则之前设置的中断服务函数会被取代。 >同一时间,只能为某个GPIO管脚设置一个中断服务函数,如果重复调用GpioSetIrq函数,则之前设置的中断服务函数会被取代。
当不再需要响应中断服务函数时,使用如下函数取消中断设置: - 当不再需要响应中断服务函数时,使用如下函数取消中断设置:
int32\_t GpioUnSetIrq\(uint16\_t gpio\); int32\_t GpioUnsetIrq\(uint16\_t gpio, void *arg\);
**表 6** GpioUnSetIrq参数和返回值描述 **表 6** GpioUnsetIrq参数和返回值描述
<a name="table1157224664316"></a> <a name="table1157224664316"></a>
<table><tbody><tr id="row175721546174317"><td class="cellrowborder" valign="top" width="48.54%"><p id="p16572144694311"><a name="p16572144694311"></a><a name="p16572144694311"></a><strong id="b55727462431"><a name="b55727462431"></a><a name="b55727462431"></a>参数</strong></p>
</td> | **参数** | **参数描述** |
<td class="cellrowborder" valign="top" width="51.459999999999994%"><p id="p185721461435"><a name="p185721461435"></a><a name="p185721461435"></a><strong id="b057213467438"><a name="b057213467438"></a><a name="b057213467438"></a>参数描述</strong></p> | ---------- | -------------- |
</td> | gpio | GPIO管脚号 |
</tr> | arg | GPIO中断数据 |
<tr id="row1257284664318"><td class="cellrowborder" valign="top" width="48.54%"><p id="p95721946144317"><a name="p95721946144317"></a><a name="p95721946144317"></a>gpio</p> | **返回值** | **返回值描述** |
</td> | 0 | 取消成功 |
<td class="cellrowborder" valign="top" width="51.459999999999994%"><p id="p1557313464439"><a name="p1557313464439"></a><a name="p1557313464439"></a>GPIO管脚号</p> | 负数 | 取消失败 |
</td>
</tr>
<tr id="row1857324618435"><td class="cellrowborder" valign="top" width="48.54%"><p id="p1257344624314"><a name="p1257344624314"></a><a name="p1257344624314"></a><strong id="b145738464432"><a name="b145738464432"></a><a name="b145738464432"></a>返回值</strong></p>
</td>
<td class="cellrowborder" valign="top" width="51.459999999999994%"><p id="p457384611439"><a name="p457384611439"></a><a name="p457384611439"></a><strong id="b17573104618432"><a name="b17573104618432"></a><a name="b17573104618432"></a>返回值描述</strong></p>
</td>
</tr>
<tr id="row357318466439"><td class="cellrowborder" valign="top" width="48.54%"><p id="p1573164616438"><a name="p1573164616438"></a><a name="p1573164616438"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="51.459999999999994%"><p id="p857384614319"><a name="p857384614319"></a><a name="p857384614319"></a>取消成功</p>
</td>
</tr>
<tr id="row18573124610433"><td class="cellrowborder" valign="top" width="48.54%"><p id="p165731146134311"><a name="p165731146134311"></a><a name="p165731146134311"></a>负数</p>
</td>
<td class="cellrowborder" valign="top" width="51.459999999999994%"><p id="p6573164613437"><a name="p6573164613437"></a><a name="p6573164613437"></a>取消失败</p>
</td>
</tr>
</tbody>
</table>
在中断服务程序设置完成后,还需要先通过如下函数使能GPIO管脚的中断: - 在中断服务程序设置完成后,还需要先通过如下函数使能GPIO管脚的中断:
int32\_t GpioEnableIrq\(uint16\_t gpio\); int32\_t GpioEnableIrq\(uint16\_t gpio\);
**表 7** GpioEnableIrq参数和返回值描述 **表 7** GpioEnableIrq参数和返回值描述
<a name="table26659291568"></a> <a name="table26659291568"></a>
<table><tbody><tr id="row866632919566"><td class="cellrowborder" valign="top" width="50%"><p id="p066642985615"><a name="p066642985615"></a><a name="p066642985615"></a><strong id="b050110291902"><a name="b050110291902"></a><a name="b050110291902"></a>参数</strong></p> | **参数** | **参数描述** |
</td> | ---------- | -------------- |
<td class="cellrowborder" valign="top" width="50%"><p id="p566613293568"><a name="p566613293568"></a><a name="p566613293568"></a><strong id="b95144291405"><a name="b95144291405"></a><a name="b95144291405"></a>参数描述</strong></p> | gpio | GPIO管脚号 |
</td> | **返回值** | **返回值描述** |
</tr> | 0 | 使能成功 |
<tr id="row19666029165620"><td class="cellrowborder" valign="top" width="50%"><p id="p16660295566"><a name="p16660295566"></a><a name="p16660295566"></a>gpio</p> | 负数 | 使能失败 |
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p1566632916566"><a name="p1566632916566"></a><a name="p1566632916566"></a>GPIO管脚号</p>
</td>
</tr>
<tr id="row84182176010"><td class="cellrowborder" valign="top" width="50%"><p id="p1566652915566"><a name="p1566652915566"></a><a name="p1566652915566"></a><strong id="b16177133216016"><a name="b16177133216016"></a><a name="b16177133216016"></a>返回值</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p966642917562"><a name="p966642917562"></a><a name="p966642917562"></a><strong id="b101898323018"><a name="b101898323018"></a><a name="b101898323018"></a>返回值描述</strong></p>
</td>
</tr>
<tr id="row154188171403"><td class="cellrowborder" valign="top" width="50%"><p id="p1866610292563"><a name="p1866610292563"></a><a name="p1866610292563"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p13666182975613"><a name="p13666182975613"></a><a name="p13666182975613"></a>使能成功</p>
</td>
</tr>
<tr id="row1041891720012"><td class="cellrowborder" valign="top" width="50%"><p id="p766642911562"><a name="p766642911562"></a><a name="p766642911562"></a>负数</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p1566652995613"><a name="p1566652995613"></a><a name="p1566652995613"></a>使能失败</p>
</td>
</tr>
</tbody>
</table>
>![](../public_sys-resources/icon-caution.gif) **注意:** >![](../public_sys-resources/icon-caution.gif) **注意:**
>必须通过此函数使能管脚中断,之前设置的中断服务函数才能被正确响应。 >必须通过此函数使能管脚中断,之前设置的中断服务函数才能被正确响应。
...@@ -406,37 +368,16 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ...@@ -406,37 +368,16 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
**表 8** GpioDisableIrq参数和返回值描述 **表 8** GpioDisableIrq参数和返回值描述
<a name="table186682041918"></a> <a name="table186682041918"></a>
<table><tbody><tr id="row186684413116"><td class="cellrowborder" valign="top" width="50%"><p id="p866844916"><a name="p866844916"></a><a name="p866844916"></a><strong id="b196681541715"><a name="b196681541715"></a><a name="b196681541715"></a>参数</strong></p> | **参数** | **参数描述** |
</td> | ---------- | -------------- |
<td class="cellrowborder" valign="top" width="50%"><p id="p46681413119"><a name="p46681413119"></a><a name="p46681413119"></a><strong id="b1966817414115"><a name="b1966817414115"></a><a name="b1966817414115"></a>参数描述</strong></p> | gpio | GPIO管脚号 |
</td> | **返回值** | **返回值描述** |
</tr> | 0 | 禁止成功 |
<tr id="row4668243113"><td class="cellrowborder" valign="top" width="50%"><p id="p46681141919"><a name="p46681141919"></a><a name="p46681141919"></a>gpio</p> | 负数 | 禁止失败 |
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p136681241311"><a name="p136681241311"></a><a name="p136681241311"></a>GPIO管脚号</p>
</td>
</tr>
<tr id="row066884412"><td class="cellrowborder" valign="top" width="50%"><p id="p566824015"><a name="p566824015"></a><a name="p566824015"></a><strong id="b9668144120"><a name="b9668144120"></a><a name="b9668144120"></a>返回值</strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p1766974515"><a name="p1766974515"></a><a name="p1766974515"></a><strong id="b466919418114"><a name="b466919418114"></a><a name="b466919418114"></a>返回值描述</strong></p>
</td>
</tr>
<tr id="row156694410112"><td class="cellrowborder" valign="top" width="50%"><p id="p14669141214"><a name="p14669141214"></a><a name="p14669141214"></a>0</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p1266934818"><a name="p1266934818"></a><a name="p1266934818"></a>禁止成功</p>
</td>
</tr>
<tr id="row176691543117"><td class="cellrowborder" valign="top" width="50%"><p id="p7669941716"><a name="p7669941716"></a><a name="p7669941716"></a>负数</p>
</td>
<td class="cellrowborder" valign="top" width="50%"><p id="p4669164219"><a name="p4669164219"></a><a name="p4669164219"></a>禁止失败</p>
</td>
</tr>
</tbody>
</table>
示例代码: 示例代码:
``` ```c
/* 中断服务函数 /* 中断服务函数
*/ */
int32_t MyCallBackFunc(uint16_t gpio, void *data) int32_t MyCallBackFunc(uint16_t gpio, void *data)
...@@ -459,21 +400,21 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ...@@ -459,21 +400,21 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
HDF_LOGE("GpioEnableIrq: failed, ret %d\n", ret); HDF_LOGE("GpioEnableIrq: failed, ret %d\n", ret);
return; return;
} }
/* 禁止3号GPIO管脚中断 */ /* 禁止3号GPIO管脚中断 */
ret = GpioDisableIrq(3); ret = GpioDisableIrq(3);
if (ret != 0) { if (ret != 0) {
HDF_LOGE("GpioDisableIrq: failed, ret %d\n", ret); HDF_LOGE("GpioDisableIrq: failed, ret %d\n", ret);
return; return;
} }
/* 取消3号GPIO管脚中断服务程序 */ /* 取消3号GPIO管脚中断服务程序 */
ret = GpioUnSetIrq(3); ret = GpioUnsetIrq(3, NULL);
if (ret != 0) { if (ret != 0) {
HDF_LOGE("GpioUnSetIrq: failed, ret %d\n", ret); HDF_LOGE("GpioUnSetIrq: failed, ret %d\n", ret);
return; return;
} }
``` ```
## 使用实例<a name="section25941262111"></a> ## 使用实例<a name="section25941262111"></a>
...@@ -484,7 +425,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ...@@ -484,7 +425,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
读者可以根据自己使用的开发板,参考其原理图,选择一个空闲的GPIO管脚即可。 读者可以根据自己使用的开发板,参考其原理图,选择一个空闲的GPIO管脚即可。
``` ```c
#include "gpio_if.h" #include "gpio_if.h"
#include "hdf_log.h" #include "hdf_log.h"
#include "osal_irq.h" #include "osal_irq.h"
...@@ -550,7 +491,7 @@ static int32_t TestCaseGpioIrqEdge(void) ...@@ -550,7 +491,7 @@ static int32_t TestCaseGpioIrqEdge(void)
OsalMDelay(200); /* wait for irq trigger */ OsalMDelay(200); /* wait for irq trigger */
timeout += 200; timeout += 200;
} }
(void)GpioUnSetIrq(gpio); (void)GpioUnsetIrq(gpio, NULL);
return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE; return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE;
} }
``` ```
......
...@@ -12,7 +12,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ...@@ -12,7 +12,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。
OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-package-directory.md) 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-overview.md)
## 开发环境 ## 开发环境
...@@ -28,7 +28,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ...@@ -28,7 +28,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存
## 开发板 ## 开发板
本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-lite-board-introduction.md),开发者可根据需要自行购买开发板。 本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-lite-introduction-hi3861.md),开发者可根据需要自行购买开发板。
## 开发流程 ## 开发流程
......
...@@ -12,7 +12,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ...@@ -12,7 +12,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文,
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。
OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-package-directory.md) 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-overview.md)
## 开发环境 ## 开发环境
...@@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ...@@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文,
## 开发板 ## 开发板
本文选取了两款典型开发板:Hi3516DV300、RK3568,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction.md),开发者可根据需要自行购买开发板。 本文选取了两款典型开发板:Hi3516DV300、RK3568,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-standard-board-introduction-hi3516.md),开发者可根据需要自行购买开发板。
## 开发流程 ## 开发流程
......
...@@ -15,7 +15,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ...@@ -15,7 +15,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[轻量与小型系统快速入门(IDE方式)](../quick-start/quickstart-ide-lite.md) 本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[轻量与小型系统快速入门(IDE方式)](../quick-start/quickstart-ide-lite-overview.md)
## 开发环境 ## 开发环境
...@@ -31,7 +31,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ...@@ -31,7 +31,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存
## 开发板 ## 开发板
本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-lite-board-introduction.md),开发者可根据需要自行购买开发板。 本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-lite-introduction-hi3861.md),开发者可根据需要自行购买开发板。
## 开发流程 ## 开发流程
......
...@@ -12,7 +12,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ...@@ -12,7 +12,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文,
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。
OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[标准系统快速入门(IDE方式)](../quick-start/quickstart-standard-ide.md) 本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[标准系统快速入门(IDE方式)](../quick-start/quickstart-ide-standard-overview.md)
## 开发环境 ## 开发环境
...@@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ...@@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文,
## 开发板 ## 开发板
本文选取了两款典型开发板:Hi3516DV300、RK3516,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction.md),开发者可根据需要自行购买开发板。 本文选取了两款典型开发板:Hi3516DV300、RK3516,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction-hi3516.md),开发者可根据需要自行购买开发板。
## 开发流程 ## 开发流程
......
...@@ -23,20 +23,20 @@ HiChecker提供的主要接口及功能如下: ...@@ -23,20 +23,20 @@ HiChecker提供的主要接口及功能如下:
| **类** | **方法(包括返回值、方法名、参数列表)** | **描述** | | **类** | **方法(包括返回值、方法名、参数列表)** | **描述** |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| HiChecker | uint_64_t&nbsp;RULE_CAUTION_PRINT_LOG<br/>=&nbsp;1&lt;&lt;63; | 告警规则,当有告警时记录日志。 | | HiChecker | uint_64_t&nbsp;RULE_CAUTION_PRINT_LOG<br/>=&nbsp;1&lt;&lt;63; | 告警规则,当有告警时记录日志。 |
| uint_64_t&nbsp;RULE_CAUTION_TRIGGER_CRASH&nbsp;=&nbsp;1&lt;&lt;62; | 告警规则,当有告警时让应用退出。 | || uint_64_t&nbsp;RULE_CAUTION_TRIGGER_CRASH&nbsp;=&nbsp;1&lt;&lt;62; | 告警规则,当有告警时让应用退出。 |
| uint_64_t&nbsp;RULE_THREAD_CHECK_SLOW_PROCESS&nbsp;=&nbsp;1; | 检测规则,检测是否有耗时函数被调用。 | || uint_64_t&nbsp;RULE_THREAD_CHECK_SLOW_PROCESS&nbsp;=&nbsp;1; | 检测规则,检测是否有耗时函数被调用。 |
| uint_64_t&nbsp;RULE_CHECK_SLOW_EVENT&nbsp;=&nbsp;1&lt;&lt;32; | 检测规则,检测有事件分发或处理超过规定的时间阈值。 | || uint_64_t&nbsp;RULE_CHECK_SLOW_EVENT&nbsp;=&nbsp;1&lt;&lt;32; | 检测规则,检测有事件分发或处理超过规定的时间阈值。 |
| uint_64_t&nbsp;RULE_CHECK_ABILITY_CONNECTION_LEAK&nbsp;=&nbsp;1&lt;&lt;33; | 检测规则,检测ability泄露。 | || uint_64_t&nbsp;RULE_CHECK_ABILITY_CONNECTION_LEAK&nbsp;=&nbsp;1&lt;&lt;33; | 检测规则,检测ability泄露。 |
| AddRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | 添加一条或者多条规则到系统,系统根据添加的规则进行检测或反馈。 | || AddRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | 添加一条或者多条规则到系统,系统根据添加的规则进行检测或反馈。 |
| RemoveRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | 删除一组规则,删除的规则后续将不再生效。 | || RemoveRule(uint_64_t&nbsp;rule)&nbsp;:&nbsp;void | 删除一组规则,删除的规则后续将不再生效。 |
| GetRule()&nbsp;:&nbsp;uint_64_t | 获取当前线程规则、进程规则、告警规则的合集。 | || GetRule()&nbsp;:&nbsp;uint_64_t | 获取当前线程规则、进程规则、告警规则的合集。 |
| Contains(uint_64_t&nbsp;rule)&nbsp;:&nbsp;bool | 当前已添加的规则集中是否包含了某一个特定的规则,&nbsp;如果传入的rule是线程级别的rule,仅查询当前线程中是否包含。 | || Contains(uint_64_t&nbsp;rule)&nbsp;:&nbsp;bool | 当前已添加的规则集中是否包含了某一个特定的规则,&nbsp;如果传入的rule是线程级别的rule,仅查询当前线程中是否包含。 |
| NotifySlowProcess(std::string&nbsp;tag)&nbsp;:&nbsp;void | 通知有慢处理,通知系统当前代码调用了耗时较长的慢处理流程,以告知应用重要线程中尽量避开直接调用。 | || NotifySlowProcess(std::string&nbsp;tag)&nbsp;:&nbsp;void | 通知有慢处理,通知系统当前代码调用了耗时较长的慢处理流程,以告知应用重要线程中尽量避开直接调用。 |
| NotifySlowEvent(std::string&nbsp;tag)&nbsp;:&nbsp;void | 通知发生事件分发超时或执行超时。 | || NotifySlowEvent(std::string&nbsp;tag)&nbsp;:&nbsp;void | 通知发生事件分发超时或执行超时。 |
| NotifyAbilityConnectionLeak(Caution&nbsp;caution)&nbsp;:&nbsp;void | 通知发生AbilityConnection泄露。 | || NotifyAbilityConnectionLeak(Caution&nbsp;caution)&nbsp;:&nbsp;void | 通知发生AbilityConnection泄露。 |
| Caution | GetTriggerRule()&nbsp;:&nbsp;uint_64_t | 获取触发当前告警的检测规则。 | | Caution | GetTriggerRule()&nbsp;:&nbsp;uint_64_t | 获取触发当前告警的检测规则。 |
| GetCautionMsg()&nbsp;:&nbsp;std::string | 获取更多辅助信息。 | || GetCautionMsg()&nbsp;:&nbsp;std::string | 获取更多辅助信息。 |
| GetStackTrace()&nbsp;:&nbsp;std::string | 获取告警触发时的堆栈信息。 | || GetStackTrace()&nbsp;:&nbsp;std::string | 获取告警触发时的堆栈信息。 |
### 开发实例 ### 开发实例
......
...@@ -16,7 +16,7 @@ HiDumper是OpenHarmony为开发、测试人员、IDE工具提供的系统信息 ...@@ -16,7 +16,7 @@ HiDumper是OpenHarmony为开发、测试人员、IDE工具提供的系统信息
/base/hiviewdfx/hidumper /base/hiviewdfx/hidumper
├── frameworks # 框架代码 ├── frameworks # 框架代码
│ ├── native # 导出功能核心代码 │ ├── native # 导出功能核心代码
│ │ │── inlude # 头文件目录 │ │ │── include # 头文件目录
│ │ │── src # 源文件目录 │ │ │── src # 源文件目录
│ │ │── common # 通用功能代码 │ │ │── common # 通用功能代码
│ │ │── executor # 导出过程执行器代码 │ │ │── executor # 导出过程执行器代码
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
- [烧录](quick-start/quickstart-ide-lite-steps-hi3861-burn.md) - [烧录](quick-start/quickstart-ide-lite-steps-hi3861-burn.md)
- [联网](quick-start/quickstart-ide-lite-steps-hi3861-netconfig.md) - [联网](quick-start/quickstart-ide-lite-steps-hi3861-netconfig.md)
- [调试验证](quick-start/quickstart-ide-lite-steps-hi3861-debug.md) - [调试验证](quick-start/quickstart-ide-lite-steps-hi3861-debug.md)
- [运行](quick-start/quickstart-ide-lite-steps-hi3861-running.md) - [运行](quick-start/quickstart-ide-lite-steps-hi3816-running.md)
- Hi3516开发板 - Hi3516开发板
- [编写“Hello World”程序](quick-start/quickstart-ide-lite-steps-hi3516-application-framework.md) - [编写“Hello World”程序](quick-start/quickstart-ide-lite-steps-hi3516-application-framework.md)
- [编译](quick-start/quickstart-ide-lite-steps-hi3516-building.md) - [编译](quick-start/quickstart-ide-lite-steps-hi3516-building.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册