提交 9191536f 编写于 作者: W wangshuainan1 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: Nwangshuainan1 <wangshuainan1@huawei.com>
......@@ -317,6 +317,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-thermal.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-update.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-usb.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-colorSpaceManager.mdd @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-vibrator.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-appAccount.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @zengyawen
......
......@@ -66,7 +66,7 @@
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
<filteritem type="filename" name="*.jpg|*.png|*.gif|*.pdf|*.xlsm" desc="already checked"/>
<filteritem type="filename" name="*.jpg|*.png|*.gif|*.pdf|*.xlsm|*.zip" desc="already checked"/>
</filefilter>
</filefilterlist>
......
......@@ -22,15 +22,16 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(): Promise&lt;number&gt;; | Queries the priority group of this application. This API uses a promise to return the result.|
| function isIdleState(bundleName: string, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether the application specified by **bundleName** is in the idle state. |
| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.|
| function getRecentlyUsedModules(callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **1000**.|
| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **maxNum**.|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | Queries the number of notifications from all applications based on the specified start time and end time.|
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.|
| function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;number&gt;): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void | Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(bundleName? : string): Promise&lt;number&gt;; | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result.|
| function setBundleGroup(bundleName : string, newGroup: GroupType, callback: AsyncCallback&gt;boolean&gt;): void | Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function setBundleGroup(bundleName : string, newGroup : GroupType): Promise&gt;boolean&gt;; | Sets the group for the application specified by **bundleName**. This API uses a promise to return the result.|
| function registerGroupCallBack(callback: Callback&gt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&gt;boolean&gt;): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
| function registerGroupCallBack(callback: Callback&gt;BundleActiveGroupCallbackInfo&gt;): Promise&gt;boolean&gt;; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
| function registerGroupCallBack(groupCallback: Callback&gt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&gt;boolean&gt;): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
| function registerGroupCallBack(groupCallback: Callback&gt;BundleActiveGroupCallbackInfo&gt;): Promise&gt;boolean&gt;; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
| function unRegisterGroupCallBack(callback: AsyncCallback&gt;boolean&gt;): void | Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result.|
| function unRegisterGroupCallBack(): Promise&gt;boolean&gt;; | Deregisters the callback for application group changes. This API uses a promise to return the result.|
......
# USB Service Development
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
## When to Use
In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
## APIs
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md).
**Table 1** Open USB APIs
......@@ -16,12 +16,12 @@ The following table lists the USB APIs currently available. For details, see the
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| hasRight(deviceName: string): boolean | Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise. |
| requestRight(deviceName: string): Promise\<boolean> | Requests the temporary permission for a given application to access the USB device. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by **getDevices()**. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by `getDevices()`. |
| getDevices(): Array<Readonly\<USBDevice>> | Obtains the USB device list. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface |
| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise\<number> | Performs bulk transfer. |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface. |
| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise\<number> | Performs bulk transfer. |
| closePipe(pipe: USBDevicePipe): number | Closes a USB device pipe. |
| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. |
| getFileDescriptor(pipe: USBDevicePipe): number | Obtains the file descriptor. |
......@@ -30,7 +30,7 @@ The following table lists the USB APIs currently available. For details, see the
## How to Develop
You can set a USB device as a host to connect to a device for data transfer. The development procedure is as follows:
You can set a USB device as the USB host to connect to other USB devices for data transfer. The development procedure is as follows:
1. Obtain the USB device list.
......@@ -113,7 +113,7 @@ You can set a USB device as a host to connect to a device for data transfer. The
Claim the corresponding interface from deviceList.
interface1 must be one present in the device configuration.
*/
usb.claimInterface(pipe , interface1, true);
usb.claimInterface(pipe, interface1, true);
```
4. Perform data transfer.
......
# FAQs
- [Ability Framework Development](faqs-ability.md)
- [Data Management Development](faqs-data-management.md)
- [File Management Development](faqs-file-management.md)
- [Graphics and Image Development](faqs-graphics.md)
- [hdc_std Command Usage](faqs-ide.md)
- [IDE Usage](faqs-hdc-std.md)
- [ArkUI (JavaScript) Development](faqs-ui-js.md)
- [ArkUI (eTS) Development](faqs-ui-ets.md)
- [Graphics and Image Development](faqs-graphics.md)
......@@ -8,6 +13,7 @@
- [Data Management Development](faqs-data-management.md)
- [Device Management Development](faqs-device-management.md)
- [Native API Usage](faqs-native.md)
- [Network and Connection Development](faqs-connectivity.md)
- [Usage of Third- and Fourth-Party Libraries](faqs-third-party-library.md)
- [Development Board](faqs-development-board.md)
# Network and Connection Development
## What are the data formats supported by extraData in an HTTP request?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
**extraData** indicates additional data in an HTTP request. It varies depending on the HTTP request method.
- If the HTTP request uses a POST or PUT method, **extraData** serves as the content of the HTTP request.
- If the HTTP request uses a GET, OPTIONS, DELETE, TRACE, or CONNECT method, **extraData** serves as a supplement to the HTTP request parameters and will be added to the URL when the request is sent.
- If you pass in a string object, **extraData** contains the string encoded on your own.
## What does error code 28 mean for an HTTP request?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
Error code 28 refers to **CURLE_OPERATION_TIMEDOUT**, which means a libcurl library operation timeout. For details, see any HTTP status code description available.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
## What does error code 6 mean for the response of \@ohos.net.http.d.ts?
Applicable to: OpenHarmony SDK 3.2.3.5
Error code 6 indicates a failure to resolve the host in the address. You can ping the URL carried in the request to check whether the host is accessible.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
# hdc_std Command Usage
## What are the commands commonly used for log management?
Applicable to: OpenHarmony SDK 3.2.2.5
- Clearing logs: hdc_std shell hilog -r
- Increasing the buffer size to 20 MB: hdc_std shell hilog -G 20M
- Capturing logs: hdc_std shell hilog &gt; log.txt
## What should I do to avoid log flow control?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
- Disabling log flow control: hdc_std shell hilog -Q pidoff
- Disabling the privacy flag: hdc_std shell hilog -p off
- Increasing the log buffer to 200 MB: hdc_std shell hilog -G 200M
- Enabling the log function of the specific domain (that is, disabling the global log function): hdc_std shell hilog –b D –D 0xd0xxxxx
After performing the preceding operations, restart the DevEco Studio.
## Is HiLog or Console recommended for log printing? How do I set the domain if HiLog is used?
Applicable to: OpenHarmony SDK 3.2.2.5
[HiLog](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md) is recommended for an application to print logs. For details about domain setting, see [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md#hilogisloggable).
## What is the maximum length of a log record when HiLog is used? Is it configurable?
Applicable to: OpenHarmony SDK 3.2.2.5
The maximum length of a log record is 1,024 characters, and it is not changeable.
## What should I do if a HAP package cannot be opened after being installed on the development board using the IDE?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Check whether the SDK version is consistent with the system version on the development board. You are advised to use the SDK version and system version that are released on the same day.
## How do I upload files using an hdc command?
Applicable to: OpenHarmony SDK 3.2.2.5
Run the **hdc_std file send** command.
## How do I prevent the screen of the RK3568 development board from turning off?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc_std shell "power-shell setmode 602"** command.
## How do I start an ability using an hdc command?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc_std shell aa start -a AbilityName -b bundleName -m moduleName** command.
# IDE Usage
## What should do if the error message "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN" is displayed?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
1. Run **npm config set strict-ssl=false** on the DevEco Studio terminal.
2. Run the **npm install** on the DevEco Studio terminal.
## After manual updating of the DevEco Studio SDK, the error message "Cannot find module 'xxx\ets\x.x.x.x\build-tools\ets-loader\node_modules\webpack\bin\webpack.js'" is displayed during HAP building. What should I do?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
1. Run **npm install** in the **ets\x.x.x.x\build-tools\ets-loader** directory of the SDK.
2. Run **npm install** in the **js\x.x.x.x\build-tools\ace-loader** directory of the SDK.
3. Perform HAP building again.
......@@ -14,7 +14,7 @@ Below are the restrictions on using generator functions in TypeScript:
- The generator function cannot contain local variables.
None of the above restrictions apply to anonymous function implementations of event handlers (such as **onClick**)
None of the above restrictions apply to anonymous function implementations of event handlers (such as **onClick**).
Negative example:
......
......@@ -117,7 +117,7 @@ This API can be used to obtain the unique ID of the audio stream, UID of the aud
console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address);
console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]);
console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]);
console.info('ChannnelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks);
console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks);
}
}
}
......
......@@ -5,7 +5,7 @@
You can call the APIs provided by the **Camera** module to develop a distributed camera that provides the basic camera functions such as shooting and video recording.
## How to Develop
Connect your calculator to a distributed device. Your calculator will call **getCameras()** to obtain the camera list and traverse the returned camera list to check **ConnctionType** of the **Camera** objects. If **ConnctionType** of a **Camera** object is **CAMERA_CONNECTION_REMOTE**, your calculator will use this object to create a **CameraInput** object. The subsequent call process is the same as that of the local camera development. For details about the local camera development, see [Camera Development](./camera.md).
Connect your calculator to a distributed device. Your calculator will call **getCameras()** to obtain the camera list and traverse the returned camera list to check **ConnectionType** of the **Camera** objects. If **ConnectionType** of a **Camera** object is **CAMERA_CONNECTION_REMOTE**, your calculator will use this object to create a **CameraInput** object. The subsequent call process is the same as that of the local camera development. For details about the local camera development, see [Camera Development](./camera.md).
For details about the APIs, see [Camera Management](../reference/apis/js-apis-camera.md).
......
......@@ -232,7 +232,6 @@ Table 11 Internal structure of the module tag
| distroFilter | Application distribution rules.<br>AppGallery uses these rules to distribute HAP files to the matching devices. Distribution rules cover three factors: API version, screen shape, and screen resolution. AppGallery distributes a HAP file to the device whose on the mapping between **deviceType** and these three factors. For details, see Table 29. | Object | Yes (initial value: left empty)<br/>Set this attribute when an application has multiple entry modules. |
| reqCapabilities | Device capabilities required for running the application. | String array| Yes (initial value: left empty) |
| commonEvents | Static broadcast. For details, see Table 35. | Object array | Yes (initial value: left empty) |
| allowClassMap | Metadata of the HAP file. The value can be **true** or **false**. If the value is **true**, the HAP file uses the Java object proxy mechanism provided by the OpenHarmony framework. | Boolean | No (initial value: **false**) |
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String | Yes (initial value: left empty) |
Example of the **module** tag structure:
......@@ -348,7 +347,7 @@ Table 17 Internal structure of the abilities attribute
| Attribute | Description | Data Type | Initial Value Allowed |
| ---------------- | ------------------------------------------------------------ | ---------- | -------------------------------------------------------- |
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. Devices running OpenHarmony do not support this attribute.| String | Yes (initial value: left empty) |
| name | Name of the ability. The value is a reverse domain name, in the format of "*Bundle name*.*Class name*", for example, **"com.example.myapplication.MainAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".MainAbility"**.<br> The ability name must be unique in an application. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.<br> Note: When you use DevEco Studio to create a project, the configuration of the first ability is generated by default, including the **MainAbility.java** file and the class name **MainAbility** defaulted in the **name** string for the **abilities** attribute in **config.json**. The value of this attribute can be customized if you use other IDE tools. The value can contain a maximum of 127 characters.| String | No |
| name | Name of the ability. The value is a reverse domain name, in the format of "*Bundle name*.*Class name*", for example, **"com.example.myapplication.MainAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".MainAbility"**.<br> The ability name must be unique in an application. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.<br> Note: If you use DevEco Studio to create the project, an ability named **MainAbility** will be created together with the default configuration in the **config.json** file. The value of this attribute can be customized if you use other IDE tools. The value can contain a maximum of 127 characters.| String | No |
| description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String | Yes (initial value: left empty) |
| icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon.<br> Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String | Yes (initial value: left empty) |
| label | Ability name visible to users. The value can be a name string or a resource index to names in multiple languages. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label.<br> Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String | Yes (initial value: left empty) |
......@@ -372,7 +371,7 @@ Table 17 Internal structure of the abilities attribute
| supportPipMode | Whether the ability allows the user to enter the Picture in Picture (PiP) mode. The PiP mode enables the user to watch a video in a small window that hovers on top of a full screen window (main window). This attribute applies only to the ability using the Page template. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| Boolean | Yes (initial value: **false**) |
| formsEnabled | Whether the ability can provide forms. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide forms.<br>**false**: This ability cannot provide forms.| Boolean | Yes (initial value: **false**) |
| forms | Details about the forms used by the ability. This attribute is valid only when **formsEnabled** is set to **true**. For details, see Table 27.| Object array | Yes (initial value: left empty) |
| srcLanguage | Programming language used to develop the ability. | String | The value can be **java**, **js**, or **ets**. |
| srcLanguage | Programming language used to develop the ability. | String | The value can be **js**, or **ets**. |
| srcPath | Path of the JS code and components corresponding to the ability. | String | Yes (initial value: left empty) |
| uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider. Devices running OpenHarmony do not support this attribute. For details, see Table 18.| Object | Yes (initial value: left empty) |
| startWindowIcon | Index to the icon file of the ability startup page. Example value: **$media:icon**. | String | Yes (initial value: left empty) |
......@@ -587,12 +586,10 @@ Table 27 Internal structure of the forms attribute
| name | Class name of the widget. The value is a string with a maximum of 127 bytes. | String | No |
| description | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes.| String | Yes (initial value: left empty) |
| isDefault | Whether the widget is a default one. Each ability has only one default widget.<br>**true**: The widget is the default one.<br>**false**: The widget is not the default one.| Boolean | No |
| type | Type of the widget. Available values are as follows:<br>**Java**: indicates a Java-programmed widget.<br>**JS**: indicates a JavaScript-programmed widget.| String | No |
| type | Type of the widget. Available values are as follows:<br>**JS**: indicates a JavaScript-programmed widget.| String | No |
| colorMode | Color mode of the widget. Available values are as follows:<br>**auto**: The widget adopts the auto-adaptive color mode.<br>**dark**: The widget adopts the dark color mode.<br>**light**: The widget adopts the light color mode.| String | Yes (initial value: **auto**)|
| supportDimensions | Grid styles supported by the widget. Available values are as follows:<br>1 * 2: indicates a grid with one row and two columns.<br>2 * 2: indicates a grid with two rows and two columns.<br>2 * 4: indicates a grid with two rows and four columns.<br>4 * 4: indicates a grid with four rows and four columns.| String array| No |
| defaultDimension | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget.| String | No |
| landscapeLayouts | Landscape layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No |
| portraitLayouts | Portrait layouts for the grid styles. Values in this array must correspond to the values in the **supportDimensions** array. This field is required only by Java-programmed widgets.| String array| No |
| updateEnabled | Whether the widget can be updated periodically. Available values are as follows:<br>**true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended.<br>**false**: The widget cannot be updated periodically.| Boolean | No |
| scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. | String | Yes (initial value: **0:0**) |
| updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.<br>If the value is **0**, this field does not take effect.<br>If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number | Yes (initial value: **0**) |
......@@ -632,9 +629,9 @@ Example of the **forms** attribute structure:
]
},
{
"name": "Form_Java",
"description": "It's Java Form",
"type": "Java",
"name": "Form_JS",
"description": "It's JS Form",
"type": "JS",
"colorMode": "auto",
"isDefault": false,
"updateEnabled": true,
......
......@@ -187,7 +187,7 @@
## Implementing Page Redirection
You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -185,7 +185,7 @@
## Implementing Page Redirection
You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -181,7 +181,7 @@
## Implementing Page Redirection
You can implement page redirection through the [page router](../ui/ui-js-building-ui-routes.md), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -146,6 +146,7 @@
- [@ohos.privacyManager](js-apis-privacyManager.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
- [@ohos.userIAM.faceAuth](js-apis-useriam-faceauth.md)
- [@system.cipher](js-apis-system-cipher.md)
- Data Management
......
......@@ -824,11 +824,8 @@ This is a system API.
**Example**
```js
let promise = call.reject(1);
promise.then(data => {
console.log(`reject success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
call.reject(1, (error, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
......
......@@ -66,15 +66,11 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_USER_STARTED | usual.event.USER_STARTED | - | Indicates the common event that the user has been started. |
| COMMON_EVENT_USER_BACKGROUND | usual.event.USER_BACKGROUND | - | Indicates the common event that the user has been brought to the background. |
| COMMON_EVENT_USER_FOREGROUND | usual.event.USER_FOREGROUND | - | Indicates the common event that the user has been brought to the foreground. |
| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_USERS | Indicates the common event that user switching is happening. |
| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_USERS | Indicates the common event that the user is going to be started. |
| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that user switching is happening. |
| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be started. |
| COMMON_EVENT_USER_UNLOCKED | usual.event.USER_UNLOCKED | - | Indicates the common event that the credential-encrypted storage has been unlocked for the current user when the device is unlocked after being restarted. |
| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_USERS | Indicates the common event that the user is going to be stopped. |
| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS | Indicates the common event that the user is going to be stopped. |
| COMMON_EVENT_USER_STOPPED | usual.event.USER_STOPPED | - | Indicates the common event that the user has been stopped. |
| COMMON_EVENT_HWID_LOGIN | common.event.HWID_LOGIN | - | Indicates the common event about a HUAWEI ID login. |
| COMMON_EVENT_HWID_LOGOUT | common.event.HWID_LOGOUT | - | Indicates the common event about a HUAWEI ID logout. |
| COMMON_EVENT_HWID_TOKEN_INVALID | common.event.HWID_TOKEN_INVALID | - | Indicates the common event that the HUAWEI ID is invalid. |
| COMMON_EVENT_HWID_LOGOFF | common.event.HWID_LOGOFF | - | Indicates the common event about a HUAWEI ID logoff. |
| COMMON_EVENT_WIFI_POWER_STATE | usual.event.wifi.POWER_STATE | - | Indicates the common event about the Wi-Fi network state, such as enabled and disabled. |
| COMMON_EVENT_WIFI_SCAN_FINISHED | usual.event.wifi.SCAN_FINISHED | ohos.permission.LOCATION | Indicates the common event that the Wi-Fi access point has been scanned and proven to be available. |
| COMMON_EVENT_WIFI_RSSI_VALUE | usual.event.wifi.RSSI_VALUE | ohos.permission.GET_WIFI_INFO | Indicates the common event that the Wi-Fi signal strength (RSSI) has changed. |
......@@ -133,8 +129,8 @@ Provides the event types supported by the **CommonEvent** module. The name and v
| COMMON_EVENT_CHARGING | usual.event.CHARGING | - | Indicates the common event that the system starts charging the battery. |
| COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED | usual.event.DEVICE_IDLE_MODE_CHANGED | - | Indicates the common event that the system idle mode has changed. |
| COMMON_EVENT_POWER_SAVE_MODE_CHANGED | usual.event.POWER_SAVE_MODE_CHANGED | - | Indicates the common event that the power saving mode of the system has changed. |
| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_USERS | Indicates the common event that a user has been added to the system. |
| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_USERS | Indicates the common event that a user has been removed from the system. |
| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been added to the system. |
| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_LOCAL_ACCOUNTS | Indicates the common event that a user has been removed from the system. |
| COMMON_EVENT_ABILITY_ADDED | usual.event.ABILITY_ADDED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been added. |
| COMMON_EVENT_ABILITY_REMOVED | usual.event.ABILITY_REMOVED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been removed. |
| COMMON_EVENT_ABILITY_UPDATED | usual.event.ABILITY_UPDATED | ohos.permission.LISTEN_BUNDLE_CHANGE | Indicates the common event that an ability has been updated. |
......
......@@ -8,7 +8,7 @@ Double-ended queue (deque) is a sequence container implemented based on the queu
**Queue** follows the principle of FIFO only and allows element removal at the front and insertion at the rear.
**Vector** supports insertion and deletion of elements in between, as well asat both the ends. When compared with **Vector**, **Deque** is more efficient in inserting and removing header elements, but less efficient in accessing elements.
**Vector** supports insertion and deletion of elements in between, as well as at both the ends. When compared with **Vector**, **Deque** is more efficient in inserting and removing header elements, but less efficient in accessing elements.
**Recommended use case**: Use **Deque** when you need to frequently insert or remove elements at both the ends of a container.
......
......@@ -484,9 +484,9 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses a
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
getRecentlyUsedModules(callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
This API uses an asynchronous callback to return at most 1000 records sorted by time (most recent first).
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -498,13 +498,12 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | No | Maximum number of returned records. The maximum and default value is **1000**. If this parameter is not specified, **1000** is used. |
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | Yes | Callback used to return the result.|
**Example**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
bundleState.getRecentlyUsedModules((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -513,11 +512,33 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
}
}
}
});
```
// Invocation when maxNum is not passed
bundleState.getRecentlyUsedModules((err, res) => {
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | Yes | Maximum number of returned records. The maximum and default value is **1000**.|
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | Yes | Callback used to return the result.|
**Example**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -526,7 +547,7 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i]));
}
}
}
});
```
......@@ -574,9 +595,9 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;number&gt;): void
queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void
Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.
Queries the priority group of the current application . This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -588,23 +609,44 @@ Queries the priority group of the application specified by **bundleName**. If **
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. |
**Example**
```javascript
// Callback with bundleName
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
// Callback without bundleName
bundleState.queryAppUsagePriorityGroup((err, res) => {
```
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void
Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name of the target application.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. |
**Example**
```javascript
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
......@@ -688,7 +730,7 @@ bundleState.setBundleGroup(bundleName, newGroup, (err) => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result.
......@@ -730,7 +772,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.
......@@ -1034,20 +1076,6 @@ Provides the usage duration information of applications.
| infosBeginTime | number | No | Time logged in the first application usage record in the **BundleActiveInfo** object.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| infosEndTime | number | No | Time logged in the last application usage record in the **BundleActiveInfo** object.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
### merge
merge(toMerge: BundleStateInfo): void
Merges the application usage information that has the same bundle name.
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | -------------- |
| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes | Application usage information to merge.|
## BundleActiveState
Provides information about an application event.
......
......@@ -60,6 +60,7 @@ Creates a Locale object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -80,6 +81,7 @@ Converts locale information to a string.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ------ | ----------- |
| string | String containing locale information.|
......@@ -100,6 +102,7 @@ Maximizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the maximized information.|
......@@ -120,6 +123,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the minimized information.|
......@@ -131,7 +135,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
```
## LocaleOptions
## LocaleOptions<sup>9+</sup>
Represents the locale options.
......@@ -173,6 +177,7 @@ Creates a **DateTimeOptions** object for the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -199,11 +204,13 @@ Formats the specified date and time.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ------- |
| date | Date | Yes | Date and time to be formatted.|
**Return Value**
| Type | Description |
| ------ | ------------ |
| string | A string containing the formatted date and time.|
......@@ -225,12 +232,14 @@ Formats the specified date range.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---- | ---- | -------- |
| startDate | Date | Yes | Start date and time to be formatted.|
| endDate | Date | Yes | End date and time to be formatted.|
**Return Value**
| Type | Description |
| ------ | -------------- |
| string | A string containing the formatted date and time range.|
......@@ -253,6 +262,7 @@ Obtains the formatting options for **DateTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------------------- |
| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects.|
......@@ -264,7 +274,7 @@ Obtains the formatting options for **DateTimeFormat** object.
```
## DateTimeOptions
## DateTimeOptions<sup>9+</sup>
Provides the options for the **DateTimeFormat** object.
......@@ -339,11 +349,13 @@ Formats a number.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---- |
| number | number | Yes | Number to be formatted.|
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Formatted number.|
......@@ -365,6 +377,7 @@ Obtains the options of the **NumberFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects.|
......@@ -377,7 +390,7 @@ Obtains the options of the **NumberFormat** object.
```
## NumberOptions
## NumberOptions<sup>9+</sup>
Provides the device capability.
......@@ -453,12 +466,14 @@ Compares two strings based on the sorting policy of the **Collator** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------------ |
| first | string | Yes | First string to compare. |
| second | string | Yes | Second string to compare.|
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string.|
......@@ -479,6 +494,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------- |
| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object.|
......@@ -490,7 +506,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
```
## CollatorOptions<sup>8+</sup><a name=collatoroptions></a>
## CollatorOptions<sup>9+</sup>
Represents the properties of a **Collator** object.
......@@ -553,11 +569,13 @@ Obtains a string that represents the singular-plural type of the specified numbe
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| n | number | Yes | Number for which the singular-plural type is to be obtained.|
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.|
......@@ -569,7 +587,7 @@ Obtains a string that represents the singular-plural type of the specified numbe
```
## PluralRulesOptions<sup>8+</sup><a name=pluralrulesoptions></a>
## PluralRulesOptions<sup>9+</sup>
Represents the properties of a **PluralRules** object.
......@@ -611,7 +629,8 @@ Creates a **RelativeTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
Parameters
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -632,12 +651,14 @@ Formats the value and unit based on the specified locale and formatting options.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Relative time after formatting.|
......@@ -658,12 +679,14 @@ Returns an array of RelativeTimeFormat objects in parts for locale-aware formatt
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
| Type | Description |
| ------------------- | --------------------------- |
| Array&lt;object&gt; | An array of **RelativeTimeFormat** objects in parts.|
......@@ -684,6 +707,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ---------------------------------------- | --------------------------------- |
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects.|
......@@ -695,7 +719,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
```
## RelativeTimeFormatInputOptions<sup>8+</sup><a name=relativetimeformatinputoptions></a>
## RelativeTimeFormatInputOptions<sup>9+</sup>
Represents the properties of a **RelativeTimeFormat** object.
......
......@@ -1130,7 +1130,7 @@ async function example() {
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail((err, pixelmap) => {
console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
console.info('mediaLibraryTest : getThumbnail successful '+ pixelmap);
});
}
```
......@@ -1168,7 +1168,7 @@ async function example() {
const fetchFileResult = await media.getFileAssets(getImageOp);
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size, (err, pixelmap) => {
console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
console.info('mediaLibraryTest : getThumbnail successful '+ pixelmap);
});
}
```
......@@ -1212,7 +1212,7 @@ async function example() {
const asset = await fetchFileResult.getFirstObject();
asset.getThumbnail(size)
.then((pixelmap) => {
console.info('mediaLibraryTest : getThumbnail Successfull '+ pixelmap);
console.info('mediaLibraryTest : getThumbnail successful '+ pixelmap);
})
.catch((err) => {
console.info('mediaLibraryTest : getThumbnail fail'+ err);
......@@ -1502,7 +1502,7 @@ async function example() {
asset.trash(true, istrashCallBack);
} else {
console.info('mediaLibraryTest : ASSET_CALLBACK isTrash Unsuccessfull = ' + err);
console.info('mediaLibraryTest : ASSET_CALLBACK isTrash Unsuccessful = ' + err);
console.info('mediaLibraryTest : ASSET_CALLBACK isTrash : FAIL');
}
......@@ -1736,7 +1736,7 @@ Obtains the next file asset in the result set. This API uses an asynchronous cal
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ----------------------------------------- |
| callbacke | AsyncCallback&lt;[FileAsset](#fileasset7)&gt; | Yes | Callback used to return the next file asset.|
| callback | AsyncCallback&lt;[FileAsset](#fileasset7)&gt; | Yes | Callback used to return the next file asset.|
**Example**
......
# OS Account Management
# OS Account Management
The **osAccount** module provides basic capabilities for managing operating system (OS) accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account, and storing OS account data to disks.
......@@ -3163,7 +3163,7 @@ This is a system API and cannot be called by third-party applications.
| FACE_AUTH_TIP_POOR_GAZE | 10 | The face is not facing the device. |
| FACE_AUTH_TIP_NOT_DETECTED | 11 | No face is detected. |
## ingerprintTips<sup>8+</sup>
## FingerprintTips<sup>8+</sup>
Enumerates the tip codes for fingerprint authentication.
......
......@@ -1041,7 +1041,7 @@ promise1.then(() => {
console.log('connect success');
let promise2 = tcp.getRemoteAddress();
promise2.then(() => {
console.log('getRemoteAddress success:' + JSON.stringify(data));
console.log('getRemoteAddress success');
}).catch(err => {
console.log('getRemoteAddressfail');
});
......@@ -1120,7 +1120,7 @@ promise.then(() => {
console.log('connect success');
let promise1 = tcp.getState();
promise1.then(() => {
console.log('getState success:' + JSON.stringify(data));
console.log('getState success');
}).catch(err => {
console.log('getState fail');
});
......
......@@ -21,9 +21,9 @@ import sensor from '@system.sensor';
## Error Codes
| Error Code | Description |
| ---- | -------------- |
| 900 | The current device does not support the corresponding sensor.|
| Error Code | Description |
| ---------- | ---------------------------------------- |
| 900 | The current device does not support the corresponding sensor. |
## sensor.subscribeAccelerometer
......@@ -37,19 +37,19 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes | Called when the acceleration sensor data changes. |
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the acceleration sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| ---- | ------ | ------- |
| x | number | Acceleration on the x-axis.|
| y | number | Acceleration on the y-axis.|
| z | number | Acceleration on the z-axis.|
| Name | Type | Description |
| ---- | ------ | --------------------------- |
| x | number | Acceleration on the x-axis. |
| y | number | Acceleration on the y-axis. |
| z | number | Acceleration on the z-axis. |
**Example**
......@@ -97,16 +97,16 @@ Subscribes to data changes of the compass sensor. If this API is called multiple
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | --------------- |
| success | Function | Yes | Called when the compass sensor data changes.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the compass sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| --------- | ------ | ---------- |
| direction | number | Direction of the device, in degrees.|
| Name | Type | Description |
| --------- | ------ | ------------------------------------ |
| direction | number | Direction of the device, in degrees. |
**Example**
......@@ -149,16 +149,16 @@ Subscribes to data changes of the proximity sensor. If this API is called multip
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ----------------- |
| success | Function | Yes | Called when the proximity sensor data changes.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the proximity sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| -------- | ------ | --------------------- |
| distance | number | Distance between a visible object and the device screen.|
| Name | Type | Description |
| -------- | ------ | ---------------------------------------- |
| distance | number | Distance between a visible object and the device screen. |
**Example**
......@@ -201,16 +201,16 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | --------------- |
| success | Function | Yes | Called when the ambient light sensor data changes|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the ambient light sensor data changes |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| --------- | ------ | ------------ |
| intensity | number | Light intensity, in lux.|
| Name | Type | Description |
| --------- | ------ | ------------------------ |
| intensity | number | Light intensity, in lux. |
**Example**
......@@ -255,16 +255,16 @@ Subscribes to data changes of the step counter sensor. If this API is called mul
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ---------------- |
| success | Function | Yes | Called when the step counter sensor data changes.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the step counter sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| ----- | ------ | --------------------- |
| steps | number | Number of counted steps after the sensor is restarted.<br>|
| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
| steps | number | Number of counted steps after the sensor is restarted.<br> |
**Example**
......@@ -302,7 +302,7 @@ sensor.unsubscribeStepCounter();
## sensor.subscribeBarometer
subcribeBarometer(Object): void
subscribeBarometer(Object): void
Subscribes to data changes of the barometer sensor. If this API is called multiple times for the same application, the last call takes effect.
......@@ -310,16 +310,16 @@ Subscribes to data changes of the barometer sensor. If this API is called multip
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ---------------- |
| success | Function | Yes | Called when the barometer sensor data changes.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the barometer sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| -------- | ------ | ----------- |
| pressure | number | Pressure, in pascal.|
| Name | Type | Description |
| -------- | ------ | -------------------- |
| pressure | number | Pressure, in pascal. |
**Example**
......@@ -366,16 +366,16 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ------------------------- |
| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | ---------------------------------------- |
| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| --------- | ------ | ---- |
| heartRate | number | Heart rate.|
| Name | Type | Description |
| --------- | ------ | ----------- |
| heartRate | number | Heart rate. |
**Example**
......@@ -421,16 +421,16 @@ Subscribes to changes of the wearing state of a wearable device. If this API is
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | -------- | ---- | ------------- |
| success | Function | Yes | Called when the wearing state changes.|
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| ------- | -------- | --------- | -------------------------------------- |
| success | Function | Yes | Called when the wearing state changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| ----- | ------- | ------ |
| value | boolean | Whether the wearable device is worn.|
| Name | Type | Description |
| ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn. |
**Example**
......@@ -473,17 +473,17 @@ Obtains the wearing state of a wearable device.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ------------ |
| success | Function | No | Callback upon success.|
| fail | Function | No | Callback upon failure.|
| complete | Function | No | Called when the execution is complete.|
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | -------------------------------------- |
| success | Function | No | Callback upon success. |
| fail | Function | No | Callback upon failure. |
| complete | Function | No | Called when the execution is complete. |
Return values of the success callback
| Name | Type | Description |
| ----- | ------- | ------ |
| value | boolean | Whether the wearable device is worn.|
| Name | Type | Description |
| ----- | ------- | ------------------------------------ |
| value | boolean | Whether the wearable device is worn. |
**Example**
......@@ -510,18 +510,18 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes | Called when the device orientation sensor data changes. |
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the device orientation sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| Name | Type | Description |
| ----- | ------ | ---------------------------------------- |
| alpha | number | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth.|
| beta | number | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth.|
| gamma | number | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth.|
| alpha | number | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth. |
| beta | number | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth. |
| gamma | number | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth. |
**Example**
......@@ -571,19 +571,19 @@ If this API is called multiple times for the same application, the last call tak
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | ---- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.|
| success | Function | Yes | Called when the gyroscope sensor data changes. |
| fail | Function | No | Callback upon failure. |
| Name | Type | Mandatory | Description |
| -------- | -------- | --------- | ---------------------------------------- |
| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data.<br>The default value is **normal**. The options are as follows:<br>- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.<br>- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.<br>- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios. |
| success | Function | Yes | Called when the gyroscope sensor data changes. |
| fail | Function | No | Callback upon failure. |
Return values of the success callback
| Name | Type | Description |
| ---- | ------ | --------- |
| x | number | Rotation angular velocity of the X axis.|
| y | number | Rotation angular velocity of the Y axis.|
| z | number | Rotation angular velocity of the Z axis.|
| Name | Type | Description |
| ---- | ------ | ---------------------------------------- |
| x | number | Rotation angular velocity of the X axis. |
| y | number | Rotation angular velocity of the Y axis. |
| z | number | Rotation angular velocity of the Z axis. |
**Example**
......
......@@ -7,7 +7,7 @@ There are two types of updates: SD card update and over the air (OTA) update.
- The SD card update depends on the update packages and SD cards.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
> **Note:**
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
......@@ -239,7 +239,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -282,7 +282,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -369,7 +369,7 @@ Obtains the description file of the current version. This API uses an asynchrono
```ts
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -406,7 +406,7 @@ Obtains the description file of the current version. This API uses a promise to
```ts
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -1580,7 +1580,7 @@ Represents an update file.
## UpgradeTaskCallback
### (eventInfo: [EventInfo](#eventinfo)): void
(eventInfo: EventInfo): void
Represents an event callback.
......
......@@ -197,9 +197,9 @@ Obtains the value of the first key-value pair based on the specified key.
**Example**
```js
let paramsOject = new Url.URLSearchParams('name=Jonathan&age=18');
let name = paramsOject.get("name"); // is the string "Jonathan"
let age = parseInt(paramsOject.get("age"), 10); // is the number 18
let paramsObject = new Url.URLSearchParams('name=Jonathan&age=18');
let name = paramsObject.get("name"); // is the string "Jonathan"
let age = parseInt(paramsObject.get("age"), 10); // is the number 18
```
......
......@@ -94,14 +94,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
**Return value**
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
**Example**
......@@ -119,14 +121,16 @@ Checks whether the application has the permission to access the device.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.|
**Example**
......@@ -140,19 +144,21 @@ console.log(bool);
requestRight(deviceName: string): Promise&lt;boolean&gt;
Requests the temporary permission for the application to access the USB device.
Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.|
**Example**
......@@ -174,16 +180,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.|
**Example**
......@@ -203,15 +211,17 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.|
**Example**
......@@ -231,15 +241,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.|
**Example**
......@@ -266,9 +278,10 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| iface | [USBInterface](#usbinterface) | Yes | USB interface to set. |
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.|
**Example**
......@@ -289,14 +302,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type| Description|
| -------- | -------- |
| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.|
**Example**
......@@ -315,15 +329,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type | Description |
| ------ | -------------------- |
| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.|
**Example**
......@@ -342,16 +357,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
......@@ -372,17 +389,19 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
......@@ -406,14 +425,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.|
**Example**
......@@ -498,8 +519,8 @@ Sets the current USB function list in Device mode.
**Return value**
| Type | Description |
| ------------------ | ------------------------------------------------------ |
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
......@@ -601,8 +622,8 @@ Sets the role types supported by a specified port, which can be **powerRole** (f
**Return value**
| Type | Description |
| ------------------ | -------------- |
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
......
# Facial Authentication
The **userIAM.faceAuth** module provides APIs for face enrollment.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
## Modules to Import
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
```
## FaceAuthManager
Provides APIs for facial authentication management.
### constructor
constructor()
A constructor used to create a **FaceAuthManager** object.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
**Return value**
| Type | Description |
| ---------------------- | -------------------- |
| [FaceAuthManager](#faceauthmanager) | **FaceAuthManager** object.|
**Example**
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
```
### setSurfaceId
setSurfaceId(surfaceId: string): ResultCode;
Sets an [XComponent surface ID](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) for the face preview page in the face enrollment process.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | -------------------------- |
| surfaceId | string | Yes | ID of the surface held by the [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).|
**Return value**
| Type | Description |
| ---------- | ------------------------------------------------------------ |
| [ResultCode](#resultcode) | Operation result code.|
**Example**
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
faceAuthManager.setSurfaceId("0");
```
## ResultCode
Enumerates the operation result codes.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
| Name | Default Value| Description |
| ----------------------- | ------ | -------------------- |
| SUCCESS | 0 | The operation is successful. |
| FAIL | 1 | The operation fails. |
......@@ -119,8 +119,6 @@ constructor()
A constructor used to create an **authenticator** object.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
......@@ -279,7 +277,8 @@ Cancels an authentication.
// contextId can be obtained using auth(). In this example, it is defined here.
let contextId = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7]);
let cancelCode = auth.cancel(contextId);
let auth = new userIAM_userAuth.UserAuth();
let cancelCode = auth.cancelAuth(contextId);
if (cancelCode == userIAM_userAuth.ResultCode.SUCCESS) {
console.info("cancel auth success");
} else {
......@@ -492,11 +491,10 @@ getAuthenticator(): Authenticator
Obtains an **Authenticator** object for user authentication.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
| Type | Description |
| ----------------------------------------- | ------------ |
| [Authenticator](#authenticatordeprecated) | **Authenticator** object obtained.|
......@@ -516,7 +514,7 @@ Provides methods to manage an **Authenticator** object.
### execute<sup>(deprecated)</sup>
execute(type: string, level: string, callback: AsyncCallback&lt;number&gt;): void
execute(type: AuthType, level: SecureLevel, callback: AsyncCallback&lt;number&gt;): void
> **NOTE**<br>
> This API is not longer maintained since API version 8. You are advised to use [auth](#auth8).
......@@ -531,8 +529,8 @@ Performs user authentication. This API uses asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Authentication type. Only **FACE_ONLY** is supported.<br>**ALL** is reserved and not supported by the current version.|
| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
| type | AuthType | Yes | Authentication type. Only **FACE_ONLY** is supported.<br>**ALL** is reserved and not supported by the current version.|
| level | SecureLevel | Yes | Security level of the authentication. It can be **S1** (lowest), **S2**, **S3**, or **S4** (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
| callback | AsyncCallback&lt;number&gt; | No | Callback used to return the result. |
Parameters returned in callback
......@@ -543,19 +541,20 @@ Performs user authentication. This API uses asynchronous callback to return the
**Example**
```js
authenticator.execute("FACE_ONLY", "S2", (code)=>{
if (code == userIAM_userAuth.AuthenticationResult.SUCCESS) {
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2", (error, code)=>{
if (code === userIAM_userAuth.ResultCode.SUCCESS) {
console.info("auth success");
return;
}
console.error("auth fail, code = " + code);
})
});
```
### execute<sup>(deprecated)</sup>
execute(type:string, level:string): Promise&lt;number&gt;
execute(type:AuthType, level:SecureLevel): Promise&lt;number&gt;
> **NOTE**<br>
> This API is not longer maintained since API version 8. You are advised to use [auth](#auth8).
......@@ -567,26 +566,28 @@ Performs user authentication. This API uses a promise to return the result.
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Authentication type. Only **FACE_ONLY** is supported.<br>**ALL** is reserved and not supported by the current version.|
| level | string | Yes | Security level of the authentication. It can be S1 (lowest), S2, S3, or S4 (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
| type | AuthType | Yes | Authentication type. Only **FACE_ONLY** is supported.<br>**ALL** is reserved and not supported by the current version.|
| level | SecureLevel | Yes | Security level of the authentication. It can be **S1** (lowest), **S2**, **S3**, or **S4** (highest).<br>Devices capable of 3D facial recognition support S3 and lower-level authentication.<br>Devices capable of 2D facial recognition support S2 and lower-level authentication.|
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
| Promise&lt;number&gt; | Promise used to return the authentication result, which is a number. For details, see [AuthenticationResult](#authenticationresultdeprecated).|
**Example**
```js
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2").then((code)=>{
console.info("auth success");
}).catch((code)=>{
console.error("auth fail, code = " + code);
});
```
```js
let authenticator = userIAM_userAuth.getAuthenticator();
authenticator.execute("FACE_ONLY", "S2").then((code)=>{
console.info("auth success");
}).catch((error)=>{
console.error("auth fail, code = " + error);
});
```
## AuthenticationResult<sup>(deprecated)</sup>
......
......@@ -1015,7 +1015,7 @@ Obtains the value of the specified key.
| Type| Description|
| -------- | -------- |
| V \| undefind | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
| V \| undefined | Returns the value of the key if a match is found in the buffer; returns **undefined** otherwise.|
**Example**
```js
......@@ -1116,7 +1116,7 @@ Removes the specified key and its value from this buffer.
| Type| Description|
| -------- | -------- |
| V \| undefind | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
| V \| undefined | Returns an **Optional** object containing the removed key-value pair if the key exists in the buffer; returns an empty **Optional** object otherwise. If the key is null, an exception will be thrown.|
**Example**
```js
......@@ -1291,7 +1291,7 @@ class Temperature{
// private readonly _temp: Temperature;
this._temp = value;
}
comapreTo(value){
compareTo(value){
return this._temp >= value.getTemp();
}
getTemp(){
......
......@@ -23,6 +23,7 @@ Enables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
......@@ -39,6 +40,7 @@ Disables the WLAN hotspot.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
......@@ -55,6 +57,7 @@ Obtains the supported power models. This API uses a promise to return the result
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Promise used to return the power models obtained.|
......@@ -84,6 +87,7 @@ Obtains the supported power models. This API uses an asynchronous callback to re
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
......@@ -100,6 +104,7 @@ Obtains the power model. This API uses a promise to return the result.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[PowerModel](#powermodel)&gt; | Promise used to return the power model obtained.|
......@@ -116,6 +121,7 @@ Obtains the power model. This API uses an asynchronous callback to return the re
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.|
......@@ -132,11 +138,13 @@ setPowerModel(model: PowerModel) : boolean;
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Power model to set.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
......@@ -20,44 +20,44 @@ Not supported
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
| Name | Type | Default Value | Mandatory | Description |
| -------------------------------- | ----------------------- | --------- | ---- | ---------------------------------------- |
| type | string | text<br>| No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**.<br>The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified.<br>The **button**, **checkbox**, and **radio** types cannot be dynamically modified. <br>- **button**: a button that can be clicked.<br>- **checkbox**: a check box.<br>- **radio**: a radio button that allows users to select one from multiple others with the same name.<br>- **text**: a single-line text field.<br>- **email**: a field used for an email address.<br>- **date**: date component, including the year, month, and day, but excluding time.<br>- **time**: time component, without the time zone.<br>- **number**: field for entering digits.<br>- **password**: password field, in which characters will be shielded.|
| checked | boolean | false | No | Whether the **\<input>** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. |
| name | string | - | No | Name of the **\<input>** component.<br>This attribute is mandatory when **type** is set to **radio**. |
| value | string | - | No | Value of the **\<input>** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name.|
| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text** \|email\|date\|time\|number\|**password**.|
| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit. |
| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated.<br>Available values include:<br>- default<br>- next<br>- go<br>- done<br>- send<br>- search<br>Except for the **next** type, clicking the Enter key hides the soft keyboard.|
| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG.|
| showcounter<sup>5+</sup> | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. |
| menuoptions<sup>5+</sup> | Array&lt;MeunOption&gt; | - | No | Menu options displayed after users click the **More** button. |
| autofocus<sup>6+</sup> | boolean | false | No | Whether to automatically obtain focus.<br>This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**.|
| selectedstart<sup>6+</sup> | number | -1 | No | Start position for text selection. |
| selectedend<sup>6+</sup> | number | -1 | No | End position for text selection. |
| softkeyboardenabled<sup>6+</sup> | boolean | true | No | Whether to display the soft keyboard during editing. |
| showpasswordicon<sup>6+</sup> | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. |
| Name | Type | Default Value | Mandatory | Description |
| -------------------------------- | ----------------------- | ------------- | --------- | ---------------------------------------- |
| type | string | text<br> | No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**.<br>The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified.<br>The **button**, **checkbox**, and **radio** types cannot be dynamically modified. <br>- **button**: a button that can be clicked.<br>- **checkbox**: a check box.<br>- **radio**: a radio button that allows users to select one from multiple others with the same name.<br>- **text**: a single-line text field.<br>- **email**: a field used for an email address.<br>- **date**: date component, including the year, month, and day, but excluding time.<br>- **time**: time component, without the time zone.<br>- **number**: field for entering digits.<br>- **password**: password field, in which characters will be shielded. |
| checked | boolean | false | No | Whether the **\<input>** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. |
| name | string | - | No | Name of the **\<input>** component.<br>This attribute is mandatory when **type** is set to **radio**. |
| value | string | - | No | Value of the **\<input>** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name. |
| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text** \|email\|date\|time\|number\|**password**. |
| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit. |
| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated.<br>Available values include:<br>- default<br>- next<br>- go<br>- done<br>- send<br>- search<br>Except for the **next** type, clicking the Enter key hides the soft keyboard. |
| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG. |
| showcounter<sup>5+</sup> | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. |
| menuoptions<sup>5+</sup> | Array&lt;MenuOption&gt; | - | No | Menu options displayed after users click the **More** button. |
| autofocus<sup>6+</sup> | boolean | false | No | Whether to automatically obtain focus.<br>This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**. |
| selectedstart<sup>6+</sup> | number | -1 | No | Start position for text selection. |
| selectedend<sup>6+</sup> | number | -1 | No | End position for text selection. |
| softkeyboardenabled<sup>6+</sup> | boolean | true | No | Whether to display the soft keyboard during editing. |
| showpasswordicon<sup>6+</sup> | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. |
**Table 1** MenuOption<sup>5+</sup>
| Name | Type | Description |
| ------- | ------ | ----------- |
| icon | string | Path of the icon for a menu option.|
| content | string | Text content of a menu option.|
| Name | Type | Description |
| ------- | ------ | ----------------------------------- |
| icon | string | Path of the icon for a menu option. |
| content | string | Text content of a menu option. |
## Styles
In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported.
| Name | Type | Default Value | Mandatory | Description |
| ------------------------ | -------------------------- | ---------- | ---- | ---------------------------------------- |
| color | &lt;color&gt; | \#e6000000 | No | Font color of the single-line text box or button. |
| font-size | &lt;length&gt; | 16px | No | Font size of the single-line text box or button. |
| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.<br>If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.|
| placeholder-color | &lt;color&gt; | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available only when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\<text>**](../arkui-js/js-components-basic-text.md) component. |
| caret-color<sup>6+</sup> | &lt;color&gt; | - | No | Color of the caret. |
| Name | Type | Default Value | Mandatory | Description |
| ------------------------ | ---------------- | ------------- | --------- | ---------------------------------------- |
| color | &lt;color&gt; | \#e6000000 | No | Font color of the single-line text box or button. |
| font-size | &lt;length&gt; | 16px | No | Font size of the single-line text box or button. |
| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.<br>If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart. |
| placeholder-color | &lt;color&gt; | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available only when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\<text>**](../arkui-js/js-components-basic-text.md) component. |
| caret-color<sup>6+</sup> | &lt;color&gt; | - | No | Color of the caret. |
## Events
......@@ -65,31 +65,31 @@ In addition to the [universal styles](../arkui-js/js-components-common-styles.md
In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported.
- When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported.
| Name | Parameter | Description |
| Name | Parameter | Description |
| ------------------------- | ---------------------------------------- | ---------------------------------------- |
| change | {<br> value: inputValue<br> } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned.<br>If you change the **value** attribute directly, this event will not be triggered.|
| enterkeyclick | {<br> value: enterKey<br> } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows:<br>- **2**: returned if **enterkeytype** is **go**.<br>- **3**: returned if **enterkeytype** is **search**.<br>- **4**: returned if **enterkeytype** is **send**.<br>- **5**: returned if **enterkeytype** is **next**.<br>- **6**: returned if **enterkeytype** is **default**, **done**, or is not set.|
| translate<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned.|
| share<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned.|
| search<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned.|
| optionselect<sup>5+</sup> | {<br> index: optionIndex,<br> value: selectedText<br> } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned.|
| selectchange<sup>6+</sup> | {<br>start: number,<br>end: number<br> } | Triggered when the text selection changes. |
| change | {<br> value: inputValue<br> } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned.<br>If you change the **value** attribute directly, this event will not be triggered. |
| enterkeyclick | {<br> value: enterKey<br> } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows:<br>- **2**: returned if **enterkeytype** is **go**.<br>- **3**: returned if **enterkeytype** is **search**.<br>- **4**: returned if **enterkeytype** is **send**.<br>- **5**: returned if **enterkeytype** is **next**.<br>- **6**: returned if **enterkeytype** is **default**, **done**, or is not set. |
| translate<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned. |
| share<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned. |
| search<sup>5+</sup> | {<br> value: selectedText<br> } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned. |
| optionselect<sup>5+</sup> | {<br> index: optionIndex,<br> value: selectedText<br> } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned. |
| selectchange<sup>6+</sup> | {<br>start: number,<br>end: number<br> } | Triggered when the text selection changes. |
- When **type** is set to **checkbox** or **radio**, the following events are supported.
| Name | Parameter | Description |
| ------ | ---------------------------------------- | ---------------------------------------- |
| change | {<br> checked:true \| false <br>} | Triggered when the checked status of the **checkbox** or **radio** button changes.|
| Name | Parameter | Description |
| ------ | --------------------------------- | ---------------------------------------- |
| change | {<br> checked:true \| false <br>} | Triggered when the checked status of the **checkbox** or **radio** button changes. |
## Methods
In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported.
| Name | Parameter | Description |
| Name | Parameter | Description |
| ------------------- | ---------------------------------------- | ---------------------------------------- |
| focus | {<br> focus: true\|false<br> }:<br>If **focus** is not passed, the default value **true** is used.| Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the input method can be displayed or collapsed. |
| showError | {<br> error: string <br>} | Displays the error message. This method is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
| focus | {<br> focus: true\|false<br> }:<br>If **focus** is not passed, the default value **true** is used. | Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the input method can be displayed or collapsed. |
| showError | {<br> error: string <br>} | Displays the error message. This method is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**. |
| delete<sup>6+</sup> | - | Deletes text based on the current caret position when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**; deletes the last character and displays the caret if the current input component does not have a caret. |
## Example
......
......@@ -3,17 +3,17 @@
> **NOTE**
>
> - This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
> - This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
>
> - Set **configChanges** under **abilities** in the **config.json** file to **orientation**.
> ```
> "abilities": [
> {
> "configChanges": ["orientation"],
> ...
> }
> ]
> ```
> - Set **configChanges** under **abilities** in the **config.json** file to **orientation**.
> ```
> "abilities": [
> {
> "configChanges": ["orientation"],
> ...
> }
> ]
> ```
The **\<video>** component provides a video player.
......@@ -27,54 +27,54 @@ Not supported
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- |
| muted | boolean | false | No| Whether the video is muted.|
| src | string | - | No| Path of the video content to play.|
| autoplay | boolean | false | No| Whether the video is played automatically after being rendered.|
| controls | boolean | true | No| Whether the control bar is displayed during video playback. If the value is set to **false**, the control bar is not displayed. The default value is **true**, indicating that the platform can either show or hide the control bar.|
| Name | Type | Default Value | Mandatory | Description |
| -------- | ------- | ------------- | --------- | ---------------------------------------- |
| muted | boolean | false | No | Whether the video is muted. |
| src | string | - | No | Path of the video content to play. |
| autoplay | boolean | false | No | Whether the video is played automatically after being rendered. |
| controls | boolean | true | No | Whether the control bar is displayed during video playback. If the value is set to **false**, the control bar is not displayed. The default value is **true**, indicating that the platform can either show or hide the control bar. |
## Styles
In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported.
| Name| Type| Default Value| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- |
| object-fit | string | contain | No| Video scale type. If **poster** has been assigned a value, the setting of this style will affect the scaling type of the video poster. For details, see object-fit enums.|
| Name | Type | Default Value | Mandatory | Description |
| ---------- | ------ | ------------- | --------- | ---------------------------------------- |
| object-fit | string | contain | No | Video scale type. If **poster** has been assigned a value, the setting of this style will affect the scaling type of the video poster. For details, see object-fit enums. |
**Table 1** object-fit enums
| Type| Description|
| -------- | -------- |
| fill | The image is resized to fill the display area, and its aspect ratio is not retained.|
| Type | Description |
| ---- | ---------------------------------------- |
| fill | The image is resized to fill the display area, and its aspect ratio is not retained. |
## Events
In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported.
| Name| Parameter| Description|
| -------- | -------- | -------- |
| prepared | {&nbsp;duration:&nbsp;value&nbsp;}<sup>5+</sup> | Triggered when the video preparation is complete. The video duration (in seconds) is obtained from **duration**.|
| start | - | Triggered when the video is played.|
| pause | - | Triggered when the video playback is paused.|
| finish | - | Triggered when the video playback is finished.|
| error | - | Triggered when the video playback fails.|
| seeking | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered to report the time (in seconds) when the progress bar is being dragged.|
| seeked | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered to report the playback time (in seconds) when the user finishes dragging the progress bar.|
| timeupdate | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered once per 250 ms when the playback progress changes. The unit of the current playback time is second.|
| Name | Parameter | Description |
| ---------- | ---------------------------------------- | ---------------------------------------- |
| prepared | {&nbsp;duration:&nbsp;value&nbsp;}<sup>5+</sup> | Triggered when the video preparation is complete. The video duration (in seconds) is obtained from **duration**. |
| start | - | Triggered when the video is played. |
| pause | - | Triggered when the video playback is paused. |
| finish | - | Triggered when the video playback is finished. |
| error | - | Triggered when the video playback fails. |
| seeking | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered to report the time (in seconds) when the progress bar is being dragged. |
| seeked | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered to report the playback time (in seconds) when the user finishes dragging the progress bar. |
| timeupdate | {&nbsp;currenttime:&nbsp;value&nbsp;} | Triggered once per 250 ms when the playback progress changes. The unit of the current playback time is second. |
## Methods
In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported.
| Name| Parameter| Description|
| -------- | -------- | -------- |
| start | - | Starts playing a video.|
| pause | - | Pauses a video.|
| setCurrentTime | {&nbsp;currenttime:&nbsp;value&nbsp;} | Sets the video playback position, in seconds.|
| Name | Parameter | Description |
| -------------- | ------------------------------------- | ---------------------------------------- |
| start | - | Starts playing a video. |
| pause | - | Pauses a video. |
| setCurrentTime | {&nbsp;currenttime:&nbsp;value&nbsp;} | Sets the video playback position, in seconds. |
> **NOTE**
>
......@@ -87,7 +87,7 @@ In addition to the [universal methods](../arkui-js/js-components-common-methods.
<div class="container">
<video id='videoId' src='/common/myDeram.mp4' muted='false' autoplay='false'
controls='true' onprepared='preparedCallback' onstart='startCallback'
onpaues='pauesCallback' onfinish='finishCallback' onerror='errorCallback'
onpause='pauseCallback' onfinish='finishCallback' onerror='errorCallback'
onseeking='seekingCallback' onseeked='seekedCallback'
ontimeupdate='timeupdateCallback'
style="object-fit:fill; width:80%; height:400px;"
......
......@@ -38,7 +38,9 @@
- [Component ID](ts-universal-attributes-component-id.md)
- [Touch Target](ts-universal-attributes-touch-target.md)
- [Polymorphic Style](ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](ts-universal-attributes-restoreId.md)
- Gesture Processing
- [Gesture Binding Methods](ts-gesture-settings.md)
- Basic Gestures
......@@ -97,10 +99,13 @@
- [Counter](ts-container-counter.md)
- [Flex](ts-container-flex.md)
- [GridContainer](ts-container-gridcontainer.md)
- [GridCol](ts-container-gridcol.md)
- [GridRow](ts-container-gridrow.md)
- [Grid](ts-container-grid.md)
- [GridItem](ts-container-griditem.md)
- [List](ts-container-list.md)
- [ListItem](ts-container-listitem.md)
- [ListItemGroup](ts-container-listitemgroup.md)
- [Navigator](ts-container-navigator.md)
- [Panel](ts-container-panel.md)
- [Refresh](ts-container-refresh.md)
......
......@@ -12,7 +12,7 @@ Not supported
## APIs
Checkbox( option?: {name?: string, group?: string })
Checkbox(options?: {name?: string, group?: string })
**Parameters**
......@@ -29,7 +29,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type| Description|
| ------------- | ------- | -------- |
| select | boolean | Whether the check box is selected.<br>Default value: **false**|
| selectedColor | [ResourceColor](../../ui/ts-types.md) | Color of the check box when it is selected.|
| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the check box when it is selected.|
## Events
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册