未验证 提交 6ada0663 编写于 作者: O openharmony_ci 提交者: Gitee

!11832 CI报错清理

Merge pull request !11832 from LiAn/master
...@@ -16,31 +16,31 @@ Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: n ...@@ -16,31 +16,31 @@ Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: n
**Parameters** **Parameters**
| Name| Value Type| Mandatory| Description| | Name | Value Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | ---------- | ---------------- | --------- | ---------------------------------------- |
| refreshing | boolean | Yes| Whether the current component is being refreshed.<br>This parameter can be used with [$$](../../ui/ts-syntactic-sugar.md) for two-way binding of variables.| | refreshing | boolean | Yes | Whether the current component is being refreshed.<br>This parameter can be used with $$ for two-way binding of variables. |
| offset | string \| number | No| Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp| | offset | string \| number | No | Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp |
| friction | number \| string | No| Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture.| | friction | number \| string | No | Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture. |
## Events ## Events
| Name| Description| | Name | Description |
| -------- | -------- | | ---------------------------------------- | ---------------------------------------- |
| onStateChange(callback: (state: RefreshStatus) => void)| Triggered when the refresh status changes.<br>- **state**: refresh status.| | onStateChange(callback: (state: RefreshStatus) => void) | Triggered when the refresh status changes.<br>- **state**: refresh status. |
| onRefreshing(callback: () => void)| Triggered when the component enters the refresh state.| | onRefreshing(callback: () => void) | Triggered when the component enters the refresh state. |
## RefreshStatus enums ## RefreshStatus enums
| Name| Description| | Name | Description |
| -------- | -------- | | -------- | ---------------------------------------- |
| Inactive | The component is not pulled down. This is the default value.| | Inactive | The component is not pulled down. This is the default value. |
| Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh.| | Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh. |
| OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh.| | OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh. |
| Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state.| | Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state. |
| Done | The refresh is complete, and the component returns to the initial state (top).| | Done | The refresh is complete, and the component returns to the initial state (top). |
## Example ## Example
......
...@@ -16,30 +16,30 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () =&gt; void, aut ...@@ -16,30 +16,30 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () =&gt; void, aut
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------------------- | ---------------------------------------- | ------------------------- | ---------------------- | | ---------------------- | ---------------------------------------- | --------- | ---------------------------------------- |
| builder | [CustomDialog](../../ui/ts-component-based-customdialog.md) | Yes | Constructor of the custom dialog box content. | | builder | CustomDialog | Yes | Constructor of the custom dialog box content. |
| cancel | () =&gt; void | No | Callback invoked when the dialog box is closed after the overlay exits. | | cancel | () =&gt; void | No | Callback invoked when the dialog box is closed after the overlay exits. |
| autoCancel | boolean | No | Whether to allow users to click the overlay to exit.<br>Default value: **true** | | autoCancel | boolean | No | Whether to allow users to click the overlay to exit.<br>Default value: **true** |
| alignment | [DialogAlignment](#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** | | alignment | [DialogAlignment](#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** |
| offset | {<br>dx: Length \| [Resource](ts-types.md#resource),<br>dy: Length \| [Resource](ts-types.md#resource)<br>} | No | Offset of the dialog box relative to the alignment position.| | offset | {<br>dx: Length \| [Resource](ts-types.md#resource),<br>dy: Length \| [Resource](ts-types.md#resource)<br>} | No | Offset of the dialog box relative to the alignment position. |
| customStyle | boolean | No | Whether to use a custom style for the dialog box.<br>Default value: **false** | | customStyle | boolean | No | Whether to use a custom style for the dialog box.<br>Default value: **false** |
| gridCount<sup>8+</sup> | number | No | Number of grid columns occupied by the dialog box. | | gridCount<sup>8+</sup> | number | No | Number of grid columns occupied by the dialog box. |
## DialogAlignment ## DialogAlignment
| Name | Description | | Name | Description |
| ------------------------ | ------- | | ------------------------ | -------------------------- |
| Top | Vertical top alignment.| | Top | Vertical top alignment. |
| Center | Vertical center alignment.| | Center | Vertical center alignment. |
| Bottom | Vertical bottom alignment.| | Bottom | Vertical bottom alignment. |
| Default | Default alignment. | | Default | Default alignment. |
| TopStart<sup>8+</sup> | Top left alignment. | | TopStart<sup>8+</sup> | Top left alignment. |
| TopEnd<sup>8+</sup> | Top right alignment. | | TopEnd<sup>8+</sup> | Top right alignment. |
| CenterStart<sup>8+</sup> | Center left alignment. | | CenterStart<sup>8+</sup> | Center left alignment. |
| CenterEnd<sup>8+</sup> | Center right alignment. | | CenterEnd<sup>8+</sup> | Center right alignment. |
| BottomStart<sup>8+</sup> | Bottom left alignment. | | BottomStart<sup>8+</sup> | Bottom left alignment. |
| BottomEnd<sup>8+</sup> | Bottom right alignment. | | BottomEnd<sup>8+</sup> | Bottom right alignment. |
## CustomDialogController ## CustomDialogController
......
...@@ -13,21 +13,21 @@ show(options?: TextPickerDialogOptions) ...@@ -13,21 +13,21 @@ show(options?: TextPickerDialogOptions)
Shows a text picker in the given settings. Shows a text picker in the given settings.
- TextPickerDialogOptions - TextPickerDialogOptions
| Name| Type| Mandatory| Default Value| Description| | Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- | | ----------------------- | ---------------------------------------- | --------- | ------------- | ---------------------------------------- |
| range | string[] \| [Resource](../../ui/ts-types.md#resource)| Yes| - | Data selection range of the picker.| | range | string[] \| [Resource](ts-types.md#resource) | Yes | - | Data selection range of the picker. |
| selected | number | No| 0 | Index of the selected item in the range.| | selected | number | No | 0 | Index of the selected item in the range. |
| value | string | No | - | Value of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead.| | value | string | No | - | Value of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead. |
| defaultPickerItemHeight | number \| string | No| - | Default height of an item in the picker.| | defaultPickerItemHeight | number \| string | No | - | Default height of an item in the picker. |
| onAccept | (value: TextPickerResult) => void | No| - | Callback invoked when the OK button in the dialog box is clicked.| | onAccept | (value: TextPickerResult) => void | No | - | Callback invoked when the OK button in the dialog box is clicked. |
| onCancel | () => void | No| - | Callback invoked when the Cancel button in the dialog box is clicked.| | onCancel | () => void | No | - | Callback invoked when the Cancel button in the dialog box is clicked. |
| onChange | (value: TextPickerResult) => void | No| - | Callback invoked when the selected item in the picker changes.| | onChange | (value: TextPickerResult) => void | No | - | Callback invoked when the selected item in the picker changes. |
- TextPickerResult - TextPickerResult
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----- | ------ | ---------------------------------------- |
| value | string | Value of the selected item.| | value | string | Value of the selected item. |
| index | number | Index of the selected item in the range.| | index | number | Index of the selected item in the range. |
## Example ## Example
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
> **NOTE** > **NOTE**
> - For wearables, the input type can only be **button**, **radio**, or **checkbox**. > - For wearables, the input type can only be **button**, **radio**, or **checkbox**.
> >
> - The settings of **checked** take effect only when the input type is set to **checkbox** or **radio**. The default value of **checked** is **false**. > - The settings of **checked** take effect only when the input type is set to **checkbox** or **radio**. The default value of **checked** is **false**.
......
...@@ -69,32 +69,32 @@ You can create resource group sub-directories (including element, media, animati ...@@ -69,32 +69,32 @@ You can create resource group sub-directories (including element, media, animati
**Table 3** Resource group sub-directories **Table 3** Resource group sub-directories
| Resource Group Sub-directory | Description | Resource File | | Resource Group Sub-directory | Description | Resource File |
| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------------------------- | ---------------------------------------- | ---------------------------------------- |
| element | Element resources. Each type of data is represented by a JSON file. The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integer<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data | It is recommended that files in the **element** sub-directory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json | | element | Element resources. Each type of data is represented by a JSON file. The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integer<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data | It is recommended that files in the **element** sub-directory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json |
| media | Media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. | | media | Media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
| profile | Other types of files, which are stored in their raw formats. | The file name can be customized. | | profile | Other types of files, which are stored in their raw formats. | The file name can be customized. |
### Media Resource Types ### Media Resource Types
**Table 4** Image resource types **Table 4** Image resource types
| Format| File Name Extension| | Format | File Name Extension |
| -------- | -------- | | ------ | ------------------- |
| JPEG | .jpg | | JPEG | .jpg |
| PNG | .png | | PNG | .png |
| GIF | .gif | | GIF | .gif |
| SVG | .svg | | SVG | .svg |
| WEBP | .webp | | WEBP | .webp |
| BMP | .bmp | | BMP | .bmp |
**Table 5** Audio and video resource types **Table 5** Audio and video resource types
| Format| File Name Extension| | Format | File Name Extension |
| -------- | -------- | | ------------------------------------ | ------------------- |
| H.263 | .3gp <br>.mp4 | | H.263 | .3gp <br>.mp4 |
| H.264 AVC <br> Baseline Profile (BP) | .3gp <br>.mp4 | | H.264 AVC <br> Baseline Profile (BP) | .3gp <br>.mp4 |
| MPEG-4 SP | .3gp | | MPEG-4 SP | .3gp |
| VP8 | .webm <br> .mkv | | VP8 | .webm <br> .mkv |
## Creating a Resource File ## Creating a Resource File
You can create a sub-directory and its files under the **resources** directory based on the above descriptions of the qualifiers sub-directories and resource group sub-directories. You can create a sub-directory and its files under the **resources** directory based on the above descriptions of the qualifiers sub-directories and resource group sub-directories.
......
...@@ -16,7 +16,7 @@ TS语言的使用在生成器函数中存在以下限制: ...@@ -16,7 +16,7 @@ TS语言的使用在生成器函数中存在以下限制:
错误示例: 错误示例:
``` ```
build() { build() {
let a: number = 1 // invalid: variable declaration not allowed let a: number = 1 // invalid: variable declaration not allowed
...@@ -36,7 +36,7 @@ build() { ...@@ -36,7 +36,7 @@ build() {
在应用中,通过"$r('app.string.xx')"的形式引用应用资源,$r的第二个参数可用于替换%s占位符。 在应用中,通过"$r('app.string.xx')"的形式引用应用资源,$r的第二个参数可用于替换%s占位符。
示例: 示例:
``` ```
build() { build() {
//do something //do something
...@@ -60,7 +60,7 @@ build() { ...@@ -60,7 +60,7 @@ build() {
示例: 示例:
``` ```
resourceManager.getRawFile(path, (error, value) => { resourceManager.getRawFile(path, (error, value) => {
if (error != null) { if (error != null) {
...@@ -96,7 +96,7 @@ Stage模型支持了通过context获取resourceManager对象的方式,再调 ...@@ -96,7 +96,7 @@ Stage模型支持了通过context获取resourceManager对象的方式,再调
示例: 示例:
``` ```
const context = getContext(this) as any const context = getContext(this) as any
context context
...@@ -113,7 +113,7 @@ context ...@@ -113,7 +113,7 @@ context
aboutToAppear函数中使用异步接口获取页面数据,使用\@State修饰变量,数据获取完成后根据变量自动刷新页面。 aboutToAppear函数中使用异步接口获取页面数据,使用\@State修饰变量,数据获取完成后根据变量自动刷新页面。
``` ```
@Entry @Entry
@Component @Component
...@@ -180,7 +180,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970 ...@@ -180,7 +180,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970
适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型 适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型
\@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../ui/ts-component-based-builder.md) \@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../quick-start/arkts-dynamic-ui-elememt-building.md#builderparam8)
## ArkTS如何把string转成byte数组 ## ArkTS如何把string转成byte数组
...@@ -188,7 +188,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970 ...@@ -188,7 +188,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970
参考如下代码实现,示例: 参考如下代码实现,示例:
``` ```
function stringToByte(str) { function stringToByte(str) {
var bytes = new Array(); var bytes = new Array();
...@@ -263,7 +263,7 @@ OpenHarmony推荐使用worker来处理多线程场景。 ...@@ -263,7 +263,7 @@ OpenHarmony推荐使用worker来处理多线程场景。
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
- namespace导出 - namespace导出
``` ```
namespace Util{ namespace Util{
export function getTime(){ export function getTime(){
...@@ -274,7 +274,7 @@ OpenHarmony推荐使用worker来处理多线程场景。 ...@@ -274,7 +274,7 @@ OpenHarmony推荐使用worker来处理多线程场景。
``` ```
- namespace导入 - namespace导入
``` ```
import Util from './util' import Util from './util'
Util.getTime() Util.getTime()
......
...@@ -10,15 +10,15 @@ ...@@ -10,15 +10,15 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | --------------------- |
| ohos.i18n | getSystemLanguage():string | 获取系统语言。 | | ohos.i18n | getSystemLanguage():string | 获取系统语言。 |
| ohos.i18n | getSystemRegion():string | 获取系统区域。 | | ohos.i18n | getSystemRegion():string | 获取系统区域。 |
| ohos.i18n | getSystemLocale():string | 获取系统Locale。 | | ohos.i18n | getSystemLocale():string | 获取系统Locale。 |
| ohos.i18n | isRTL(locale:string):boolean<sup>7+</sup> | locale对应的语言是否为从右到左语言。 | | ohos.i18n | isRTL(locale:string):boolean<sup>7+</sup> | locale对应的语言是否为从右到左语言。 |
| ohos.i18n | is24HourClock():boolean<sup>7+</sup> | 获取当前系统时间是否采用24小时制。 | | ohos.i18n | is24HourClock():boolean<sup>7+</sup> | 获取当前系统时间是否采用24小时制。 |
| ohos.i18n | getDisplayLanguage(language:string,locale:string,sentenceCase?:boolean):string | 获取语言的本地化表示。 | | ohos.i18n | getDisplayLanguage(language:string,locale:string,sentenceCase?:boolean):string | 获取语言的本地化表示。 |
| ohos.i18n | getDisplayCountry(country:string,locale:string,sentenceCase?:boolean):string | 获取国家的本地化表示。 | | ohos.i18n | getDisplayCountry(country:string,locale:string,sentenceCase?:boolean):string | 获取国家的本地化表示。 |
### 开发步骤 ### 开发步骤
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
2. 获取系统区域。 2. 获取系统区域。
调用getSystemRegion方法获取当前系统设置的区域 调用getSystemRegion方法获取当前系统设置的区域
```js ```js
var region = i18n.getSystemRegion(); var region = i18n.getSystemRegion();
``` ```
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
3. 获取系统Locale。 3. 获取系统Locale。
调用getSystemLocale方法获取当前系统设置的Locale 调用getSystemLocale方法获取当前系统设置的Locale
```js ```js
var locale = i18n.getSystemLocale(); var locale = i18n.getSystemLocale();
``` ```
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
5. 判断当前系统时间是否采用24小时制。 5. 判断当前系统时间是否采用24小时制。
调用is24HourClock方法来判断当前系统的时间是否采用24小时制。 调用is24HourClock方法来判断当前系统的时间是否采用24小时制。
```js ```js
var hourClock = i18n.is24HourClock(); var hourClock = i18n.is24HourClock();
``` ```
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
6. 获取语言的本地化表示。 6. 获取语言的本地化表示。
调用getDisplayLanguage方法获取某一语言的本地化表示。其中,language表示待本地化显示的语言,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。 调用getDisplayLanguage方法获取某一语言的本地化表示。其中,language表示待本地化显示的语言,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。
```js ```js
var language = "en"; var language = "en";
var locale = "zh-CN"; var locale = "zh-CN";
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
7. 获取国家的本地化表示。 7. 获取国家的本地化表示。
调用getDisplayCountry方法获取某一国家的本地化表示。其中,country表示待本地化显示的国家,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。 调用getDisplayCountry方法获取某一国家的本地化表示。其中,country表示待本地化显示的国家,locale表示本地化的Locale,sentenceCase结果是否需要首字母大写。
```js ```js
var country = "US"; var country = "US";
var locale = "zh-CN"; var locale = "zh-CN";
...@@ -90,27 +90,27 @@ ...@@ -90,27 +90,27 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | --------------------- |
| ohos.i18n | getCalendar(locale:string,type?:string):Calendar<sup>8+</sup> | 获取指定locale和type的日历对象。 | | ohos.i18n | getCalendar(locale:string,type?:string):Calendar<sup>8+</sup> | 获取指定locale和type的日历对象。 |
| ohos.i18n | setTime(date:Date): void<sup>8+</sup> | 设置日历对象内部的时间日期。 | | ohos.i18n | setTime(date:Date): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | setTime(time:number): void<sup>8+</sup> | 设置日历对象内部的时间日期。 | | ohos.i18n | setTime(time:number): void<sup>8+</sup> | 设置日历对象内部的时间日期。 |
| ohos.i18n | set(year:number,month:number,date:number,hour?:number,minute?:number,second?:number): void<sup>8+</sup> | 设置日历对象的年、月、日、时、分、秒。 | | ohos.i18n | set(year:number,month:number,date:number,hour?:number,minute?:number,second?:number): void<sup>8+</sup> | 设置日历对象的年、月、日、时、分、秒。 |
| ohos.i18n | setTimeZone(timezone:string): void<sup>8+</sup> | 设置日历对象的时区。 | | ohos.i18n | setTimeZone(timezone:string): void<sup>8+</sup> | 设置日历对象的时区。 |
| ohos.i18n | getTimeZone():string<sup>8+</sup> | 获取日历对象的时区。 | | ohos.i18n | getTimeZone():string<sup>8+</sup> | 获取日历对象的时区。 |
| ohos.i18n | getFirstDayOfWeek():number<sup>8+</sup> | 获取日历对象的一周起始日。 | | ohos.i18n | getFirstDayOfWeek():number<sup>8+</sup> | 获取日历对象的一周起始日。 |
| ohos.i18n | setFirstDayOfWeek(value:number): void<sup>8+</sup> | 设置日历对象的一周起始日。 | | ohos.i18n | setFirstDayOfWeek(value:number): void<sup>8+</sup> | 设置日历对象的一周起始日。 |
| ohos.i18n | getMinimalDaysInFirstWeek():number<sup>8+</sup> | 获取一年中第一周的最小天数。 | | ohos.i18n | getMinimalDaysInFirstWeek():number<sup>8+</sup> | 获取一年中第一周的最小天数。 |
| ohos.i18n | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | 设置一年中第一周的最小天数。 | | ohos.i18n | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | 设置一年中第一周的最小天数。 |
| ohos.i18n | getDisplayName(locale:string):string<sup>8+</sup> | 获取日历对象的本地化表示。 | | ohos.i18n | getDisplayName(locale:string):string<sup>8+</sup> | 获取日历对象的本地化表示。 |
| ohos.i18n | isWeekend(date?:Date):boolean<sup>8+</sup> | 判断给定的日期是否在日历中是周末。 | | ohos.i18n | isWeekend(date?:Date):boolean<sup>8+</sup> | 判断给定的日期是否在日历中是周末。 |
### 开发步骤 ### 开发步骤
1. 实例化日历对象。 1. 实例化日历对象。
调用getCalendar方法获取指定locale和type的时区对象(i18n为导入的模块)。其中,type表示合法的日历类型,目前合法的日历类型包括:"buddhist", "chinese", "coptic", "ethiopic", "hebrew", "gregory", "indian", "islamic_civil", "islamic_tbla", "islamic_umalqura", "japanese", "persian"。当type没有给出时,采用区域默认的日历类型。 调用getCalendar方法获取指定locale和type的时区对象(i18n为导入的模块)。其中,type表示合法的日历类型,目前合法的日历类型包括:"buddhist", "chinese", "coptic", "ethiopic", "hebrew", "gregory", "indian", "islamic_civil", "islamic_tbla", "islamic_umalqura", "japanese", "persian"。当type没有给出时,采用区域默认的日历类型。
```js ```js
var calendar = i18n.getCalendar("zh-CN", "gregory"); var calendar = i18n.getCalendar("zh-CN", "gregory");
``` ```
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
2. 设置日历对象的时间。 2. 设置日历对象的时间。
调用setTime方法设置日历对象的时间。setTime方法接收两种类型的参数。一种是传入一个Date对象,另一种是传入一个数值表示从1970.1.1 00:00:00 GMT逝去的毫秒数。 调用setTime方法设置日历对象的时间。setTime方法接收两种类型的参数。一种是传入一个Date对象,另一种是传入一个数值表示从1970.1.1 00:00:00 GMT逝去的毫秒数。
```js ```js
var date1 = new Date(); var date1 = new Date();
calendar.setTime(date1); calendar.setTime(date1);
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
3. 设置日历对象的年、月、日、时、分、秒。 3. 设置日历对象的年、月、日、时、分、秒。
调用set方法设置日历对象的年、月、日、时、分、秒。 调用set方法设置日历对象的年、月、日、时、分、秒。
```js ```js
calendar.set(2021, 12, 21, 6, 0, 0) calendar.set(2021, 12, 21, 6, 0, 0)
``` ```
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
4. 设置、获取日历对象的时区。 4. 设置、获取日历对象的时区。
调用setTimeZone方法和getTimeZone方法来设置、获取日历对象的时区。其中,setTimeZone方法需要传入一个字符串表示需要设置的时区。 调用setTimeZone方法和getTimeZone方法来设置、获取日历对象的时区。其中,setTimeZone方法需要传入一个字符串表示需要设置的时区。
```js ```js
calendar.setTimeZone("Asia/Shanghai"); calendar.setTimeZone("Asia/Shanghai");
var timezone = calendar.getTimeZone(); var timezone = calendar.getTimeZone();
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
6. 设置、获取日历对象第一周的最小天数 6. 设置、获取日历对象第一周的最小天数
调用setMinimalDaysInFirstWeek方法和getMinimalDaysInFirstWeek方法来设置、获取日历对象第一周的最小天数。 调用setMinimalDaysInFirstWeek方法和getMinimalDaysInFirstWeek方法来设置、获取日历对象第一周的最小天数。
```js ```js
calendar.setMinimalDaysInFirstWeek(3); calendar.setMinimalDaysInFirstWeek(3);
var minimalDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek(); var minimalDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
7. 获取日历对象的本地化显示 7. 获取日历对象的本地化显示
调用getDisplayName来获取日历对象的本地化显示。 调用getDisplayName来获取日历对象的本地化显示。
```js ```js
var localizedName = calendar.getDisplayName("zh-CN"); var localizedName = calendar.getDisplayName("zh-CN");
``` ```
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
8. 判断某一个日期是否为周末。 8. 判断某一个日期是否为周末。
调用isWeekend方法来判断输入的Date是否为周末。 调用isWeekend方法来判断输入的Date是否为周末。
```js ```js
var date = new Date(); var date = new Date();
var weekend = calendar.isWeekend(date); var weekend = calendar.isWeekend(date);
...@@ -182,18 +182,18 @@ ...@@ -182,18 +182,18 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | ----------------------- |
| ohos.i18n | constructor(country:string,options?:PhoneNumberFormatOptions)<sup>8+</sup> | 实例化PhoneNumberFormat对象。 | | ohos.i18n | constructor(country:string,options?:PhoneNumberFormatOptions)<sup>8+</sup> | 实例化PhoneNumberFormat对象。 |
| ohos.i18n | isValidNumber(number:string):boolean<sup>8+</sup> | 判断number是否是一个格式正确的电话号码。 | | ohos.i18n | isValidNumber(number:string):boolean<sup>8+</sup> | 判断number是否是一个格式正确的电话号码。 |
| ohos.i18n | format(number:string):string<sup>8+</sup> | 对number按照指定国家及风格进行格式化。 | | ohos.i18n | format(number:string):string<sup>8+</sup> | 对number按照指定国家及风格进行格式化。 |
### 开发步骤 ### 开发步骤
1. 实例化电话号码格式化对象。 1. 实例化电话号码格式化对象。
调用PhoneNumberFormat的构造函数来实例化电话号码格式化对象,需要传入电话号码的国家代码及格式化选项。其中,格式化选项是可选的,包括style选项,该选项的取值包括:"E164", "INTERNATIONAL", "NATIONAL", "RFC3966"。 调用PhoneNumberFormat的构造函数来实例化电话号码格式化对象,需要传入电话号码的国家代码及格式化选项。其中,格式化选项是可选的,包括style选项,该选项的取值包括:"E164", "INTERNATIONAL", "NATIONAL", "RFC3966"。
```js ```js
var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"}); var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"});
``` ```
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
2. 判断电话号码格式是否正确。 2. 判断电话号码格式是否正确。
调用isValidNumber方法来判断输入的电话号码的格式是否正确。 调用isValidNumber方法来判断输入的电话号码的格式是否正确。
```js ```js
var validNumber = phoneNumberFormat.isValidNumber("15812341234"); var validNumber = phoneNumberFormat.isValidNumber("15812341234");
``` ```
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
3. 电话号码格式化。 3. 电话号码格式化。
调用电话号码格式化对象的format方法来对输入的电话号码进行格式化。 调用电话号码格式化对象的format方法来对输入的电话号码进行格式化。
```js ```js
var formattedNumber = phoneNumberFormat.format("15812341234"); var formattedNumber = phoneNumberFormat.format("15812341234");
``` ```
...@@ -220,15 +220,15 @@ ...@@ -220,15 +220,15 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | --------------------------------------- |
| ohos.i18n | unitConvert(fromUnit:UnitInfo,toUnit:UnitInfo,value:number,locale:string,style?:string):string<sup>8+</sup> | 将fromUnit的单位转换为toUnit的单位,并根据区域与风格进行格式化。 | | ohos.i18n | unitConvert(fromUnit:UnitInfo,toUnit:UnitInfo,value:number,locale:string,style?:string):string<sup>8+</sup> | 将fromUnit的单位转换为toUnit的单位,并根据区域与风格进行格式化。 |
### 开发步骤 ### 开发步骤
1. 度量衡单位转换。 1. 度量衡单位转换。
调用[unitConvert](../reference/apis/js-apis-i18n.md#unitconvert8)方法实现度量衡单位转换,并进行格式化显示的功能。 调用[unitConvert](../reference/apis/js-apis-i18n.md#unitconvert9)方法实现度量衡单位转换,并进行格式化显示的功能。
```js ```js
var fromUnit = {unit: "cup", measureSystem: "US"}; var fromUnit = {unit: "cup", measureSystem: "US"};
...@@ -245,12 +245,12 @@ ...@@ -245,12 +245,12 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | ----------------------- |
| ohos.i18n | getInstance(locale?:string):IndexUtil<sup>8+</sup> | 实例化字母表索引对象。 | | ohos.i18n | getInstance(locale?:string):IndexUtil<sup>8+</sup> | 实例化字母表索引对象。 |
| ohos.i18n | getIndexList():Array&lt;string&gt;<sup>8+</sup> | 获取当前Locale的索引列表。 | | ohos.i18n | getIndexList():Array&lt;string&gt;<sup>8+</sup> | 获取当前Locale的索引列表。 |
| ohos.i18n | addLocale(locale:string): void<sup>8+</sup> | 将新的Locale对应的索引加入当前索引列表。 | | ohos.i18n | addLocale(locale:string): void<sup>8+</sup> | 将新的Locale对应的索引加入当前索引列表。 |
| ohos.i18n | getIndex(text:string):string<sup>8+</sup> | 获取text对应的索引。 | | ohos.i18n | getIndex(text:string):string<sup>8+</sup> | 获取text对应的索引。 |
### 开发步骤 ### 开发步骤
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
调用getInstance方法来实例化特定locale对应的字母表索引对象。当locale参数为空时,实例化系统默认Locale的字母表索引对象。 调用getInstance方法来实例化特定locale对应的字母表索引对象。当locale参数为空时,实例化系统默认Locale的字母表索引对象。
```js ```js
var indexUtil = i18n.getInstance("zh-CN"); var indexUtil = i18n.getInstance("zh-CN");
``` ```
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
2. 获取索引列表。 2. 获取索引列表。
调用getIndexList方法来获取当前Locale对应的字母表索引列表。 调用getIndexList方法来获取当前Locale对应的字母表索引列表。
```js ```js
var indexList = indexUtil.getIndexList(); var indexList = indexUtil.getIndexList();
``` ```
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
3. 增加新的索引。 3. 增加新的索引。
调用addLocale方法,将新的Locale对应的字母表索引添加到当前字母表索引列表中。 调用addLocale方法,将新的Locale对应的字母表索引添加到当前字母表索引列表中。
```js ```js
indexUtil.addLocale("ar") indexUtil.addLocale("ar")
``` ```
...@@ -282,7 +282,7 @@ ...@@ -282,7 +282,7 @@
4. 获取字符串对应的索引。 4. 获取字符串对应的索引。
调用getIndex方法来获取某一字符串对应的字母表索引。 调用getIndex方法来获取某一字符串对应的字母表索引。
```js ```js
var text = "access index"; var text = "access index";
indexUtil.getIndex(text); indexUtil.getIndex(text);
...@@ -294,18 +294,18 @@ ...@@ -294,18 +294,18 @@
### 接口说明 ### 接口说明
| 模块 | 接口名称 | 描述 | | 模块 | 接口名称 | 描述 |
| -------- | -------- | -------- | | --------- | ---------------------------------------- | ------------------------------ |
| ohos.i18n | getLineInstance(locale:string):BreakIterator<sup>8+</sup> | 实例化断行对象。 | | ohos.i18n | getLineInstance(locale:string):BreakIterator<sup>8+</sup> | 实例化断行对象。 |
| ohos.i18n | setLineBreakText(text:string): void<sup>8+</sup> | 设置要处理的文本。 | | ohos.i18n | setLineBreakText(text:string): void<sup>8+</sup> | 设置要处理的文本。 |
| ohos.i18n | getLineBreakText():string<sup>8+</sup> | 获取要处理的文本。 | | ohos.i18n | getLineBreakText():string<sup>8+</sup> | 获取要处理的文本。 |
| ohos.i18n | current():number<sup>8+</sup> | 获取当前断行对象在处理文本的位置。 | | ohos.i18n | current():number<sup>8+</sup> | 获取当前断行对象在处理文本的位置。 |
| ohos.i18n | first():number<sup>8+</sup> | 将断行对象设置到第一个可断句的分割点。 | | ohos.i18n | first():number<sup>8+</sup> | 将断行对象设置到第一个可断句的分割点。 |
| ohos.i18n | last():number<sup>8+</sup> | 将断行对象设置到最后一个可断句的分割点。 | | ohos.i18n | last():number<sup>8+</sup> | 将断行对象设置到最后一个可断句的分割点。 |
| ohos.i18n | next(index?:number):number<sup>8+</sup> | 将断行对象移动index个分割点的位置。 | | ohos.i18n | next(index?:number):number<sup>8+</sup> | 将断行对象移动index个分割点的位置。 |
| ohos.i18n | previous():number<sup>8+</sup> | 将断行对象移动到前一个分割点的位置。 | | ohos.i18n | previous():number<sup>8+</sup> | 将断行对象移动到前一个分割点的位置。 |
| ohos.i18n | following(offset:number):number<sup>8+</sup> | 将断行对象移动到offset指定位置的后面一个分割点的位置。 | | ohos.i18n | following(offset:number):number<sup>8+</sup> | 将断行对象移动到offset指定位置的后面一个分割点的位置。 |
| ohos.i18n | isBoundary(offset:number):boolean<sup>8+</sup> | 判断某个位置是否是分割点。 | | ohos.i18n | isBoundary(offset:number):boolean<sup>8+</sup> | 判断某个位置是否是分割点。 |
### 开发步骤 ### 开发步骤
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
3. 获取断行对象当前的位置。 3. 获取断行对象当前的位置。
调用current方法来获取断行对象在当前处理文本中的位置。 调用current方法来获取断行对象在当前处理文本中的位置。
```js ```js
var pos = breakIterator.current(); var pos = breakIterator.current();
``` ```
...@@ -355,7 +355,7 @@ ...@@ -355,7 +355,7 @@
5. 判断某个位置是否为分割点。 5. 判断某个位置是否为分割点。
调用isBoundary方法来判断一个方法是否为分割点;如果该位置是分割点,则返回true,并且将断行对象移动到该位置;如果该位置不是分割点,则返回false,并且将断行对象移动到该位置后的一个分割点。 调用isBoundary方法来判断一个方法是否为分割点;如果该位置是分割点,则返回true,并且将断行对象移动到该位置;如果该位置不是分割点,则返回false,并且将断行对象移动到该位置后的一个分割点。
```js ```js
var isboundary = breakIterator.isBoundary(5); var isboundary = breakIterator.isBoundary(5);
``` ```
\ No newline at end of file
...@@ -30,7 +30,7 @@ matchMediaSync(condition: string): MediaQueryListener ...@@ -30,7 +30,7 @@ matchMediaSync(condition: string): MediaQueryListener
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------------------------------- | | --------- | ------ | ---- | ---------------------------------------- |
| condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/ui-ts-layout-mediaquery.md#媒体查询条件语法规则)。 | | condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/ui-ts-layout-mediaquery.md#语法规则)。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
......
...@@ -62,10 +62,10 @@ ...@@ -62,10 +62,10 @@
除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件: 除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| -------------- | ---------------------------------------- | ------------------------- | | -------- | ---------------------------------------- | ------------------------- |
| complete(Rich) | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片成功加载时触发该回调,返回成功加载的图源尺寸。 | | complete | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片成功加载时触发该回调,返回成功加载的图源尺寸。 |
| error(Rich) | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片加载出现异常时触发该回调,异常时长宽为零。 | | error | {<br>&nbsp;width:width,<br>&nbsp;height:height<br>&nbsp;} | 图片加载出现异常时触发该回调,异常时长宽为零。 |
## 方法 ## 方法
......
...@@ -44,11 +44,11 @@ ...@@ -44,11 +44,11 @@
除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件: 除支持[通用事件](../arkui-js/js-components-common-events.md)外,还支持如下事件:
| 名称 | 参数 | 描述 | | 名称 | 参数 | 描述 |
| ------------ | ---- | ---------------------------------------- | | ------ | ---- | ---------------------------------------- |
| bounce(Rich) | - | 当文本滚动到末尾时触发该事件。 | | bounce | - | 当文本滚动到末尾时触发该事件。 |
| finish(Rich) | - | 当完成滚动次数时触发该事件。需要在&nbsp;loop&nbsp;属性值大于&nbsp;0&nbsp;时触发。 | | finish | - | 当完成滚动次数时触发该事件。需要在&nbsp;loop&nbsp;属性值大于&nbsp;0&nbsp;时触发。 |
| start(Rich) | - | 当文本滚动开始时触发该事件。 | | start | - | 当文本滚动开始时触发该事件。 |
## 方法 ## 方法
......
...@@ -33,16 +33,16 @@ ...@@ -33,16 +33,16 @@
除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式: 除支持[通用样式](../arkui-js/js-components-common-styles.md)外,还支持如下样式:
| 名称 | 类型 | 默认值 | 必填 | 描述 | | 名称 | 类型 | 默认值 | 必填 | 描述 |
| ------------------- | -------------------------- | ---------- | ---- | ---------------------------------------- | | ------------- | -------------------------- | ---------- | ---- | ---------------------------------------- |
| texton-color(Rich) | &lt;color&gt; | \#000000 | 否 | 选中时显示的文本颜色,仅设置texton和textoff生效。 | | texton-color | &lt;color&gt; | \#000000 | 否 | 选中时显示的文本颜色,仅设置texton和textoff生效。 |
| textoff-color(Rich) | &lt;color&gt; | \#000000 | 否 | 未选中时显示的文本颜色,仅设置texton和textoff生效。 | | textoff-color | &lt;color&gt; | \#000000 | 否 | 未选中时显示的文本颜色,仅设置texton和textoff生效。 |
| text-padding(Rich) | number | 0px | 否 | texton/textoff中最长文本两侧距离滑块边界的距离。 | | text-padding | number | 0px | 否 | texton/textoff中最长文本两侧距离滑块边界的距离。 |
| font-size(Rich) | &lt;length&gt; | - | 否 | 文本尺寸,仅设置texton和textoff生效。 | | font-size | &lt;length&gt; | - | 否 | 文本尺寸,仅设置texton和textoff生效。 |
| allow-scale(Rich) | boolean | true | 否 | 文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果在config描述文件中针对ability配置了fontSize的config-changes标签,则应用不会重启而直接生效。 | | allow-scale | boolean | true | 否 | 文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果在config描述文件中针对ability配置了fontSize的config-changes标签,则应用不会重启而直接生效。 |
| font-style(Rich) | string | normal | 否 | 字体样式,仅设置texton和textoff生效。见text组件[font-style的样式属性](../arkui-js/js-components-basic-text.md#样式)。 | | font-style | string | normal | 否 | 字体样式,仅设置texton和textoff生效。见text组件[font-style的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-weight(Rich) | number&nbsp;\|&nbsp;string | normal | 否 | 字体粗细,仅设置texton和textoff生效。见text组件的[font-weight的样式属性](../arkui-js/js-components-basic-text.md#样式)。 | | font-weight | number&nbsp;\|&nbsp;string | normal | 否 | 字体粗细,仅设置texton和textoff生效。见text组件的[font-weight的样式属性](../arkui-js/js-components-basic-text.md#样式)。 |
| font-family(Rich) | string | sans-serif | 否 | 字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。仅设置texton和textoff生效。 | | font-family | string | sans-serif | 否 | 字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](../arkui-js/js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。仅设置texton和textoff生效。 |
## 事件 ## 事件
......
...@@ -50,17 +50,17 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业 ...@@ -50,17 +50,17 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
**表1** 长时任务种类 **表1** 长时任务种类
| 后台模式 | 说明 | 通知栏显示提示 | 备注 | | 后台模式 | 说明 | 通知栏显示提示 | 备注 |
| -------- | -------- | -------- | -------- | | --------------------- | ------------------------- | ------------ | ------------------------- |
| dataTransfer | 通过网络/对端设备进行数据下载、备份、分享、传输等 | 正在运行数据传输任务 | - | | dataTransfer | 通过网络/对端设备进行数据下载、备份、分享、传输等 | 正在运行数据传输任务 | - |
| audioPlayback | 音频输出 | 正在运行音频播放任务 | - | | audioPlayback | 音频输出 | 正在运行音频播放任务 | - |
| audioRecording | 音频输入 | 正在运行录音任务 | - | | audioRecording | 音频输入 | 正在运行录音任务 | - |
| location | 定位、导航 | 正在运行定位任务 | - | | location | 定位、导航 | 正在运行定位任务 | - |
| bluetoothInteraction | 蓝牙传输 | 正在运行蓝牙相关任务 | - | | bluetoothInteraction | 蓝牙传输 | 正在运行蓝牙相关任务 | - |
| multiDeviceConnection | 分布式互联任务 | 正在运行分布式任务 | - | | multiDeviceConnection | 分布式互联任务 | 正在运行分布式任务 | - |
| wifiInteraction | WLAN传输 | 正在运行WLAN相关任务 | System API,仅对System权限应用开放 | | wifiInteraction | WLAN传输 | 正在运行WLAN相关任务 | System API,仅对System权限应用开放 |
| voip | 音视频电话、VOIP | 正在运行通话相关任务 | System API,仅对System权限应用开放 | | voip | 音视频电话、VOIP | 正在运行通话相关任务 | System API,仅对System权限应用开放 |
| taskKeeping | 计算任务 | 正在运行计算任务 | 仅在特定设备生效 | | taskKeeping | 计算任务 | 正在运行计算任务 | 仅在特定设备生效 |
### 长时任务使用约束 ### 长时任务使用约束
- 如果用户选择可感知业务(如播音、导航等),触发对应后台模式,在任务启动时,系统会强制弹出通知提醒用户。 - 如果用户选择可感知业务(如播音、导航等),触发对应后台模式,在任务启动时,系统会强制弹出通知提醒用户。
...@@ -79,15 +79,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业 ...@@ -79,15 +79,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
- **超时**:系统会设置超时机制,延迟任务回调只允许运行一段时间,超时之后,系统会主动停止。默认的超时限制为2分钟,对于系统应用,可以通过[申请能效资源](efficiency-resources-apply-dev-guide.md)获取更长的执行时间(充电状态20分钟,非充电状态10分钟)。 - **超时**:系统会设置超时机制,延迟任务回调只允许运行一段时间,超时之后,系统会主动停止。默认的超时限制为2分钟,对于系统应用,可以通过[申请能效资源](efficiency-resources-apply-dev-guide.md)获取更长的执行时间(充电状态20分钟,非充电状态10分钟)。
- **执行频率**:系统会根据应用的活跃度对延迟任务做分级管控,限制延迟任务调度的执行频率。对于通过能效资源接口申请了WORK_SCHEDULER资源的应用,在资源的有效期内,它的延迟任务执行频率不受限制。 - **执行频率**:系统会根据应用的活跃度对延迟任务做分级管控,限制延迟任务调度的执行频率。对于通过能效资源接口申请了WORK_SCHEDULER资源的应用,在资源的有效期内,它的延迟任务执行频率不受限制。
| 应用分组 | 延迟任务执行频率约束 | | 应用分组 | 延迟任务执行频率约束 |
| --------------------|------------------------- | | ---------------------------------------- | ---------- |
| 活跃 | 最小间隔2小时 | | 活跃 | 最小间隔2小时 |
| 每日使用 | 最小间隔4小时 | | 每日使用 | 最小间隔4小时 |
| 经常使用 | 最小间隔24小时 | | 经常使用 | 最小间隔24小时 |
| 不经常使用 | 最小间隔48小时 | | 不经常使用 | 最小间隔48小时 |
| 受限分组 | 禁止 | | 受限分组 | 禁止 |
| 未使用分组 | 禁止 | | 未使用分组 | 禁止 |
| [能效资源豁免分组](../reference/apis/js-apis-backgroundTaskManager.md#resourcetype9) | 执行频率不受限制 | | [能效资源豁免分组](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#resourcetype) | 执行频率不受限制 |
- **WorkInfo设置参数约束** - **WorkInfo设置参数约束**
...@@ -111,15 +111,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业 ...@@ -111,15 +111,15 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业
**表1** 能效资源种类 **表1** 能效资源种类
| 参数名 | 参数值 | 描述 | | 参数名 | 参数值 | 描述 |
| ----------------------- | ---- | --------------------- | | -------------- | ---- | ------------------- |
| CPU | 1 | CPU资源,申请后不被挂起 | | CPU | 1 | CPU资源,申请后不被挂起 |
| COMMON_EVENT | 2 | 公共事件,申请后挂起状态下不被代理掉 | | COMMON_EVENT | 2 | 公共事件,申请后挂起状态下不被代理掉 |
| TIMER | 4 | 计时器,申请后挂起状态下不被代理掉 | | TIMER | 4 | 计时器,申请后挂起状态下不被代理掉 |
| WORK_SCHEDULER | 8 | 延迟任务,申请后有更长的执行时间 | | WORK_SCHEDULER | 8 | 延迟任务,申请后有更长的执行时间 |
| BLUETOOTH | 16 | 蓝牙相关,申请后挂起状态下不被代理掉 | | BLUETOOTH | 16 | 蓝牙相关,申请后挂起状态下不被代理掉 |
| GPS | 32 | GPS相关,申请后挂起状态下不被代理掉 | | GPS | 32 | GPS相关,申请后挂起状态下不被代理掉 |
| AUDIO | 64 | 音频资源,申请后挂起状态下不被代理掉 | | AUDIO | 64 | 音频资源,申请后挂起状态下不被代理掉 |
### 能效资源使用约束 ### 能效资源使用约束
- 能效资源申请或者释放可以由进程或者应用发起,由应用发起的资源释放会释放属于它的同类型的所有资源,包括进程申请的资源。例如应用申请了CPU资源,进程申请了CPU和WORK_SCHEDULER资源,当应用释放CPU资源的时候,会将进程的CPU资源一同释放,同时不同类型的WORK_SCHEDULER资源不受影响。由进程发起的资源释放对应用申请的资源没有影响,例如当应用和进程同时申请了CPU,进程发起了CPU资源释放,应用的CPU资源不会被释放。 - 能效资源申请或者释放可以由进程或者应用发起,由应用发起的资源释放会释放属于它的同类型的所有资源,包括进程申请的资源。例如应用申请了CPU资源,进程申请了CPU和WORK_SCHEDULER资源,当应用释放CPU资源的时候,会将进程的CPU资源一同释放,同时不同类型的WORK_SCHEDULER资源不受影响。由进程发起的资源释放对应用申请的资源没有影响,例如当应用和进程同时申请了CPU,进程发起了CPU资源释放,应用的CPU资源不会被释放。
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
**表1** 申请能效资源主要接口 **表1** 申请能效资源主要接口
| 接口名 | 描述 | | 接口名 | 描述 |
| ---------------------------------------- | ---------------------------------------- | | ---------------------------------------- | ---------- |
| applyEfficiencyResources(request: [EfficiencyResourcesRequest](../reference/apis/js-apis-backgroundTaskManager.md#efficiencyresourcesrequest9)): boolean | 申请能效资源。 | | applyEfficiencyResources(request: [EfficiencyResourcesRequest](../reference/apis/js-apis-resourceschedule-backgroundTaskManager.md#efficiencyresourcesrequest)): boolean | 申请能效资源。 |
| resetAllEfficiencyResources():void | 释放申请的能效资源。 | | resetAllEfficiencyResources():void | 释放申请的能效资源。 |
### 开发步骤 ### 开发步骤
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册