提交 c1db506a 编写于 作者: S shawn_he 提交者: Gitee

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

...@@ -197,7 +197,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to- ...@@ -197,7 +197,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to-
OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository. OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository.
OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](contribute/third-party-open-source-software-and-license-notice.md). OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md).
## Contact Info<a name="section61728335424"></a> ## Contact Info<a name="section61728335424"></a>
......
...@@ -18,13 +18,13 @@ The table below describes the ability call APIs. For details, see [Ability](../r ...@@ -18,13 +18,13 @@ The table below describes the ability call APIs. For details, see [Ability](../r
**Table 1** Ability call APIs **Table 1** Ability call APIs
|API|Description| |API|Description|
|:------|:------| |:------|:------|
|Promise<Caller> startAbilityByCall(want: Want)|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.| |startAbilityByCall(want: Want): Promise<Caller>|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.|
|void on(method: string, callback: CalleeCallBack)|Callee.on: callback invoked when the callee registers a method.| |on(method: string, callback: CaleeCallBack): void|Callback invoked when the callee registers a method.|
|void off(method: string)|Callee.off: callback invoked when the callee deregisters a method.| |off(method: string): void|Callback invoked when the callee deregisters a method.|
|Promise<void> call(method: string, data: rpc.Sequenceable)|Caller.call: sends agreed sequenceable data to the callee.| |call(method: string, data: rpc.Sequenceable): Promise<void>|Sends agreed sequenceable data to the callee.|
|Promise<rpc.MessageParcel> callWithResult(method: string, data: rpc.Sequenceable)|Caller.callWithResult: sends agreed sequenceable data to the callee and returns the agreed sequenceable data.| |callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>|Sends agreed sequenceable data to the callee and returns the agreed sequenceable data.|
|void release()|Caller.release: releases the caller interface.| |release(): void|Releases the caller interface.|
|void onRelease(callback: OnReleaseCallBack)|Caller.onRelease: registers a callback that is invoked when the caller is disconnected.| |onRelease(callback: OnReleaseCallBack): void|Registers a callback that is invoked when the caller is disconnected.|
## How to Develop ## How to Develop
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
...@@ -202,7 +202,7 @@ context.requestPermissionsFromUser(permissions).then((data) => { ...@@ -202,7 +202,7 @@ context.requestPermissionsFromUser(permissions).then((data) => {
``` ```
3. Send agreed sequenceable data. 3. Send agreed sequenceable data.
The sequenceable data can be sent to the callee with or without a return value. The method and sequenceable data must be consistent with those of the callee. The following example describes how to invoke the **Call** API to send data to the callee. The sample code snippet is as follows: The sequenceable data can be sent to the callee with or without a return value. The method and sequenceable data must be consistent with those of the callee. The following example describes how to invoke the **Call** API to send data to the callee. The sample code snippet is as follows:
```ts ```ts
const MSG_SEND_METHOD: string = 'CallSendMsg' const MSG_SEND_METHOD: string = 'CallSendMsg'
async onButtonCall() { async onButtonCall() {
...@@ -237,7 +237,7 @@ async onButtonCallWithResult(originMsg, backMsg) { ...@@ -237,7 +237,7 @@ async onButtonCallWithResult(originMsg, backMsg) {
``` ```
4. Release the caller interface. 4. Release the caller interface.
When the caller interface is no longer required, call the **release** API to release it. The sample code snippet is as follows: When the caller interface is no longer required, call the **release** API to release it. The sample code snippet is as follows:
```ts ```ts
try { try {
this.caller.release() this.caller.release()
......
...@@ -41,7 +41,7 @@ If a service needs to be continued when the application or service module is run ...@@ -41,7 +41,7 @@ If a service needs to be continued when the application or service module is run
backgroundTaskManager.getRemainingDelayTime(id).then( res => { backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res)); console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => { }).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data); console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
}); });
``` ```
...@@ -74,7 +74,7 @@ console.info("The actualDelayTime is: " + time); ...@@ -74,7 +74,7 @@ console.info("The actualDelayTime is: " + time);
backgroundTaskManager.getRemainingDelayTime(id).then( res => { backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res)); console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => { }).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data); console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
}); });
// Cancel the suspension delay. // Cancel the suspension delay.
...@@ -187,7 +187,7 @@ For details about how to use the Service ability in the FA model, see [Service A ...@@ -187,7 +187,7 @@ For details about how to use the Service ability in the FA model, see [Service A
If an application does not need to interact with a continuous task in the background, you can use **startAbility()** to start the Service ability. In the **onStart** callback of the Service ability, call **startBackgroundRunning()** to declare that the Service ability needs to run in the background for a long time. After the task execution is complete, call **stopBackgroundRunning()** to release resources. If an application does not need to interact with a continuous task in the background, you can use **startAbility()** to start the Service ability. In the **onStart** callback of the Service ability, call **startBackgroundRunning()** to declare that the Service ability needs to run in the background for a long time. After the task execution is complete, call **stopBackgroundRunning()** to release resources.
If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the Service ability. After obtaining the proxy of the Service ability, the application can communicate with the Service ability and control the application and cancellation of continuous tasks. If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the Service ability. After obtaining the proxy of the Service ability, the application can communicate with the Service ability and control the request and cancellation of continuous tasks.
```js ```js
import backgroundTaskManager from '@ohos.backgroundTaskManager'; import backgroundTaskManager from '@ohos.backgroundTaskManager';
...@@ -284,3 +284,9 @@ export default { ...@@ -284,3 +284,9 @@ export default {
} }
}; };
``` ```
## Samples
The following sample is provided to help you better understand how to develop background task management:
- [<idp:inline class="- topic/inline " val="code" displayname="code" id="code1035211243011" tempcmdid="code1035211243011">BackgroundTaskManager</idp:inline>: Background Task Management (eTS, API version 8)](https://gitee.com/openharmony/app_samples/tree/master/ResourcesSchedule/BackgroundTaskManager)
...@@ -195,7 +195,7 @@ APIs are provided to access the system language and region information. ...@@ -195,7 +195,7 @@ APIs are provided to access the system language and region information.
``` ```
var phoneNumberFormat = new i18n.PhoneNubmerFormat("CN", {type: "E164"}); var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"});
``` ```
2. Check whether the phone number format is correct. 2. Check whether the phone number format is correct.
...@@ -215,12 +215,12 @@ APIs are provided to access the system language and region information. ...@@ -215,12 +215,12 @@ APIs are provided to access the system language and region information.
## Measurement Conversion ## Measurement Conversion
An API can be called to implement measurement conversion. The **unitConvert** API is provided to help you implement measurement conversion.
### Available APIs ### Available APIs
| Module | API | Description | | Module | API | Description |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| ohos.i18n | unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string<sup>8+</sup> | Converts one measurement unit (**fromUnit**) into another (**toUnit**) and formats the unit based on the specified locale and style. | | ohos.i18n | unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string<sup>8+</sup> | Converts one measurement unit (**fromUnit**) into another (**toUnit**) and formats the unit based on the specified locale and style. |
......
...@@ -493,6 +493,74 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => { ...@@ -493,6 +493,74 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
}) })
``` ```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>
Obtains information about the bundles contained in a HAP file. This API uses a promise to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
**Return value**
| Type | Description |
| -------------- | -------------------------------------- |
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.|
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
.then((data) => {
console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>) : void
Obtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| hapFilePath | string | Yes | Path where the HAP file is stored. The path should point to the relative directory of the current application's data directory.|
| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. The default value is **0**. The value must be greater than 0.|
| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the information about the bundles. |
**Example**
```js
let hapFilePath = "/data/xxx/test.hap";
let bundleFlags = 0;
bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => {
if (err) {
console.error('Operation failed. Cause: ' + JSON.stringify(err));
return;
}
console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
## bundle.getAbilityInfo ## bundle.getAbilityInfo
getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo> getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>
...@@ -1233,7 +1301,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1233,7 +1301,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------------------------ | | --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). | | Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1268,7 +1336,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1268,7 +1336,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- | | ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. | | bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. | | abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md). | | callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1309,7 +1377,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1309,7 +1377,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------------------------ | | --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). | | Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1346,7 +1414,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1346,7 +1414,7 @@ SystemCapability.BundleManager.BundleFramework
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. | | bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| moduleName | string | Yes | Module name based on which the pixel map is to obtain. | | moduleName | string | Yes | Module name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. | | abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md). | | callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
**Example** **Example**
...@@ -1544,6 +1612,7 @@ Enumerates bundle flags. ...@@ -1544,6 +1612,7 @@ Enumerates bundle flags.
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. | | GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. |
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. | | GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. |
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. | | GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. |
| GET_BUNDLE_WITH_HASH_VALUE<sup>9+</sup> | 0x00000030 | Obtains the bundle information with the information about hash value. |
## BundleOptions ## BundleOptions
......
# Ability # Ability
> **NOTE**<br> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> 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 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.
...@@ -18,11 +18,11 @@ import Ability from '@ohos.application.Ability'; ...@@ -18,11 +18,11 @@ import Ability from '@ohos.application.Ability';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | Yes | No | Context of an ability. | | context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
| launchWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters for starting the ability. | | launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
| lastRequestWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters used when the ability was started last time. | | lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
## Ability.onCreate ## Ability.onCreate
...@@ -35,10 +35,10 @@ Called to initialize the service logic when an ability is created. ...@@ -35,10 +35,10 @@ Called to initialize the service logic when an ability is created.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Information related to this ability, including the ability name and bundle name. | | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
| param | AbilityConstant.LaunchParam | Yes | Parameters for starting the ability, and the reason for the last abnormal exit. | | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
**Example** **Example**
...@@ -61,9 +61,9 @@ Called when a **WindowStage** is created for this ability. ...@@ -61,9 +61,9 @@ Called when a **WindowStage** is created for this ability.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. | | windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example** **Example**
...@@ -105,9 +105,9 @@ Called when the **WindowStage** is restored during the migration of this ability ...@@ -105,9 +105,9 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. | | windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example** **Example**
...@@ -143,7 +143,7 @@ Called when this ability is destroyed to clear resources. ...@@ -143,7 +143,7 @@ Called when this ability is destroyed to clear resources.
onForeground(): void; onForeground(): void;
Called when this ability is running in the foreground. Called when this ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -162,7 +162,7 @@ Called when this ability is running in the foreground. ...@@ -162,7 +162,7 @@ Called when this ability is running in the foreground.
onBackground(): void; onBackground(): void;
Callback when this ability is switched to the background. Called when this ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -187,15 +187,15 @@ Called to save data during the ability migration preparation process. ...@@ -187,15 +187,15 @@ Called to save data during the ability migration preparation process.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes | **want** parameter. | | wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes| **want** parameter.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result. | | AbilityConstant.OnContinueResult | Continuation result.|
**Example** **Example**
...@@ -220,9 +220,9 @@ Called when the ability startup mode is set to singleton. ...@@ -220,9 +220,9 @@ Called when the ability startup mode is set to singleton.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. | | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
**Example** **Example**
...@@ -245,9 +245,9 @@ Called when the configuration of the environment where the ability is running is ...@@ -245,9 +245,9 @@ Called when the configuration of the environment where the ability is running is
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes | New configuration. | | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
**Example** **Example**
...@@ -275,16 +275,16 @@ Sends sequenceable data to the target ability. ...@@ -275,16 +275,16 @@ Sends sequenceable data to the target ability.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return a response. | | Promise&lt;void&gt; | Promise used to return a response.|
**Example** **Example**
...@@ -345,16 +345,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data ...@@ -345,16 +345,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability. | | Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability.|
**Example** **Example**
...@@ -451,9 +451,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc ...@@ -451,9 +451,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. | | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
**Example** **Example**
...@@ -486,7 +486,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc ...@@ -486,7 +486,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc
## Callee ## Callee
Implements callbacks for caller notification registration and unregistration. Implements callbacks for caller notification registration and deregistration.
## Callee.on ## Callee.on
...@@ -499,10 +499,10 @@ Registers a caller notification callback, which is invoked when the target abili ...@@ -499,10 +499,10 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. | | method | string | Yes| Notification message string negotiated between the two abilities.|
| callback | CaleeCallBack | Yes | JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails. | | callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
**Example** **Example**
...@@ -546,15 +546,15 @@ Registers a caller notification callback, which is invoked when the target abili ...@@ -546,15 +546,15 @@ Registers a caller notification callback, which is invoked when the target abili
off(method: string): void; off(method: string): void;
Unregisters a caller notification callback, which is invoked when the target ability registers a function. Deregisters a caller notification callback, which is invoked when the target ability registers a function.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Registered notification message string. | | method | string | Yes| Registered notification message string.|
**Example** **Example**
...@@ -575,9 +575,9 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -575,9 +575,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| (msg: string) | function | Yes | No | Prototype of the listener function interface registered by the caller. | | (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.|
## CaleeCallBack ## CaleeCallBack
...@@ -586,6 +586,6 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -586,6 +586,6 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes | No | Prototype of the message listener function interface registered by the callee. | | (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.|
# AbilityLifecycleCallback
> **NOTE**<br>
> 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.
A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context.
## AbilityLifecycleCallback.onAbilityCreate
onAbilityCreate(ability: Ability): void;
Called when an ability is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityWindowStageCreate
onAbilityWindowStageCreate(ability: Ability): void;
Called when the window stage of an ability is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityWindowStageDestroy
onAbilityWindowStageDestroy(ability: Ability): void;
Called when the window stage of an ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityDestroy
onAbilityDestroy(ability: Ability): void;
Called when an ability is destroyed.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityForeground
onAbilityForeground(ability: Ability): void;
Called when an ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityBackground
onAbilityBackground(ability: Ability): void;
Called when an ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
## AbilityLifecycleCallback.onAbilityContinue
onAbilityContinue(ability: Ability): void;
Called when an ability is continued on another device.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.|
**Example**
```js
import AbilityStage from "@ohos.application.AbilityStage";
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
let AbilityLifecycleCallback = {
onAbilityCreate(ability){
console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability));
},
onAbilityWindowStageCreate(ability){
console.log("AbilityLifecycleCallback onAbilityWindowStageCreate ability:" + JSON.stringify(ability));
},
onAbilityWindowStageDestroy(ability){
console.log("AbilityLifecycleCallback onAbilityWindowStageDestroy ability:" + JSON.stringify(ability));
},
onAbilityDestroy(ability){
console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability));
},
onAbilityForeground(ability){
console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability));
},
onAbilityBackground(ability){
console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability));
},
onAbilityContinue(ability){
console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability));
}
}
// 1. Obtain applicationContext through the context attribute.
let applicationContext = this.context.getApplicationContext();
// 2. Use applicationContext to register a listener for the ability lifecycle in the application.
let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleid));
}
}
```
# ApplicationContext
> **NOTE**<br>
> 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.
Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application.
## How to Use
Before calling any APIs in **ApplicationContext**, obtain an **ApplicationContext** instance through the **context** instance.
```js
let applicationContext = this.context.getApplicationContext();
```
## ApplicationContext.registerAbilityLifecycleCallback
registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**;
Registers a listener to monitor the ability lifecycle of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ------------------------ | -------- | ---- | ------------------------------ |
| [AbilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md) | callback | Yes | Callback used to return the ID of the registered listener.|
**Return value**
| Type | Description |
| ------ | ------------------------------ |
| number | ID of the registered listener. The ID is incremented by 1 each time the listener is registered. When the ID exceeds 2^63-1, **-1** is returned.|
**Example**
```js
let applicationContext = this.context.getApplicationContext();
console.log("stage applicationContext: " + JSON.stringify(applicationContext));
let lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleid));
```
## ApplicationContext.unregisterAbilityLifecycleCallback
unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**;
Deregisters the listener that monitors the ability lifecycle of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ------------- | -------- | ---- | -------------------------- |
| callbackId | number | Yes | ID of the listener to deregister.|
| AsyncCallback | callback | Yes | Callback used to return the result. |
**Example**
```js
let applicationContext = this.context.getApplicationContext();
console.log("stage applicationContext: " + JSON.stringify(applicationContext));
applicationContext.unregisterAbilityLifecycleCallback(lifecycleid, (error, data) => {
console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error));
});
```
# MissionInfo
> **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import MissionInfo from '@ohos.application.missionInfo'
```
## MissionInfo
Provides the mission information.
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Yes| Mission ID.|
| runningState | number | Yes| Yes| Running state of the mission.|
| lockedState | boolean | Yes| Yes| Locked state of the mission.|
| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.|
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission is continuable.|
# Background Task Management # Background Task Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -25,7 +25,7 @@ The default duration of delayed suspension is 180000 when the battery level is h ...@@ -25,7 +25,7 @@ The default duration of delayed suspension is 180000 when the battery level is h
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------ | | -------- | -------------------- | ---- | ------------------------------ |
| reason | string | Yes | Reason for delayed transition to the suspended state. | | reason | string | Yes | Reason for delayed transition to the suspended state. |
| callback | Callback&lt;void&gt; | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out. | | callback | Callback&lt;void&gt; | Yes | Invoked when a delay is about to time out. Generally, this callback is used to notify the application 6 seconds before the delay times out.|
**Return value** **Return value**
| Type | Description | | Type | Description |
...@@ -66,10 +66,10 @@ Obtains the remaining duration before the application is suspended. This API use ...@@ -66,10 +66,10 @@ Obtains the remaining duration before the application is suspended. This API use
```js ```js
let id = 1; let id = 1;
backgroundTaskManager.getRemainingDelayTime(id, (err, res) => { backgroundTaskManager.getRemainingDelayTime(id, (err, res) => {
if(err.data === 0) { if(err) {
console.log('callback => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res)); console.log('callback => Operation getRemainingDelayTime failed. Cause: ' + err.code);
} else { } else {
console.log('callback => Operation getRemainingDelayTime failed. Cause: ' + err.data); console.log('callback => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
} }
}) })
``` ```
...@@ -99,7 +99,7 @@ Obtains the remaining duration before the application is suspended. This API use ...@@ -99,7 +99,7 @@ Obtains the remaining duration before the application is suspended. This API use
backgroundTaskManager.getRemainingDelayTime(id).then( res => { backgroundTaskManager.getRemainingDelayTime(id).then( res => {
console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res)); console.log('promise => Operation getRemainingDelayTime succeeded. Data: ' + JSON.stringify(res));
}).catch( err => { }).catch( err => {
console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.data); console.log('promise => Operation getRemainingDelayTime failed. Cause: ' + err.code);
}) })
``` ```
...@@ -190,12 +190,12 @@ Requests a continuous task from the system. This API uses a promise to return th ...@@ -190,12 +190,12 @@ Requests a continuous task from the system. This API uses a promise to return th
| --------- | ---------------------------------- | ---- | ----------------------- | | --------- | ---------------------------------- | ---- | ----------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. | | context | [Context](js-apis-Context.md) | Yes | Application context. |
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. | | bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. | | wantAgent | [WantAgent](js-apis-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------- | | -------------- | ---------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
```js ```js
...@@ -238,7 +238,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to ...@@ -238,7 +238,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ----------------------------- | ---- | ---------------------- | | -------- | ----------------------------- | ---- | ---------------------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. | | context | [Context](js-apis-Context.md) | Yes | Application context. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example** **Example**
```js ```js
...@@ -268,12 +268,12 @@ Requests to cancel a continuous task. This API uses a promise to return the resu ...@@ -268,12 +268,12 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ----------------------------- | ---- | --------- | | ------- | ----------------------------- | ---- | --------- |
| context | [Context](js-apis-Context.md) | Yes | Application context. | | context | [Context](js-apis-Context.md) | Yes | Application context.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ---------------- | | -------------- | ---------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
```js ```js
......
...@@ -35,3 +35,4 @@ Provides the HAP module information. ...@@ -35,3 +35,4 @@ Provides the HAP module information.
| mainElementName<sup>9+</sup> | string | Yes | No | Information about the main ability. | | mainElementName<sup>9+</sup> | string | Yes | No | Information about the main ability. |
| extensionAbilityInfo<sup>9+</sup> | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.| | extensionAbilityInfo<sup>9+</sup> | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.|
| metadata<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. | | metadata<sup>9+</sup> | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
| hashValue<sup>9+</sup> | string | Yes | No | The hash value of the module. |
\ No newline at end of file
...@@ -5,7 +5,6 @@ The call module provides call management functions, including making calls, redi ...@@ -5,7 +5,6 @@ The call module provides call management functions, including making calls, redi
To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange). To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange).
>**NOTE**<br> >**NOTE**<br>
>
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -27,10 +26,10 @@ Initiates a call. This API uses an asynchronous callback to return the result. ...@@ -27,10 +26,10 @@ Initiates a call. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------- | ---- | -------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example** **Example**
...@@ -53,11 +52,11 @@ Initiates a call. You can set call options as needed. This API uses an asynchron ...@@ -53,11 +52,11 @@ Initiates a call. You can set call options as needed. This API uses an asynchron
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | | options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example** **Example**
...@@ -82,16 +81,16 @@ Initiates a call. You can set call options as needed. This API uses a promise to ...@@ -82,16 +81,16 @@ Initiates a call. You can set call options as needed. This API uses a promise to
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | -------------------------------------- | | ----------- | --------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call.| | options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ------------------------------------------------------------ | | ---------------------- | ---------------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure| | Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure |
**Example** **Example**
...@@ -116,10 +115,10 @@ Launches the call screen and displays the dialed number. This API uses an asynch ...@@ -116,10 +115,10 @@ Launches the call screen and displays the dialed number. This API uses an asynch
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ------------------------- | ---- | ------------------------------------------ | | ----------- | ------------------------- | ---- | ------------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -140,15 +139,15 @@ Launches the call screen and displays the dialed number. This API uses a promise ...@@ -140,15 +139,15 @@ Launches the call screen and displays the dialed number. This API uses a promise
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------- | | ----------- | ------ | ---- | ---------- |
| phoneNumber | string | Yes | Phone number.| | phoneNumber | string | Yes | Phone number. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | --------------------------------- | | ------------------- | --------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -171,9 +170,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to ...@@ -171,9 +170,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress. |
**Example** **Example**
...@@ -196,7 +195,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu ...@@ -196,7 +195,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu
| Type | Description | | Type | Description |
| ---------------------- | --------------------------------------- | | ---------------------- | --------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -220,9 +219,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re ...@@ -220,9 +219,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -245,7 +244,7 @@ Obtains the call status. This API uses a promise to return the result. ...@@ -245,7 +244,7 @@ Obtains the call status. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| -------------------------------------- | --------------------------------------- | | -------------------------------------- | --------------------------------------- |
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result.| | Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -270,7 +269,7 @@ Checks whether a device supports voice calls. ...@@ -270,7 +269,7 @@ Checks whether a device supports voice calls.
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
| boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls.| | boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls. |
```js ```js
let result = call.hasVoiceCapability(); let result = call.hasVoiceCapability();
...@@ -287,10 +286,10 @@ Checks whether the called number is an emergency number. This API uses an asynch ...@@ -287,10 +286,10 @@ Checks whether the called number is an emergency number. This API uses an asynch
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
**Example** **Example**
...@@ -311,11 +310,11 @@ Checks whether the called number is an emergency number based on the phone numbe ...@@ -311,11 +310,11 @@ Checks whether the called number is an emergency number based on the phone numbe
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | | ----------- | -------------------------------------------------- | ---- | -------------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. | | options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. |
**Example** **Example**
...@@ -336,16 +335,16 @@ Checks whether the called number is an emergency number based on the phone numbe ...@@ -336,16 +335,16 @@ Checks whether the called number is an emergency number based on the phone numbe
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------------- | ---- | -------------- | | ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option.| | options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number option. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | --------------------------------------------------- | | ---------------------- | --------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -370,10 +369,10 @@ A formatted phone number is a standard numeric string, for example, 555 0100. ...@@ -370,10 +369,10 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ------------------------------------ | | ----------- | --------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -395,11 +394,11 @@ A formatted phone number is a standard numeric string, for example, 555 0100. ...@@ -395,11 +394,11 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------ | | ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code. | | options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -424,16 +423,16 @@ A formatted phone number is a standard numeric string, for example, 555 0100. ...@@ -424,16 +423,16 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | -------------------------------------------- | ---- | ---------------------- | | ----------- | -------------------------------------------- | ---- | ---------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code.| | options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting option, for example, country code. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------- | | --------------------- | ------------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -460,11 +459,11 @@ The phone number must match the specified country code. For example, for a China ...@@ -460,11 +459,11 @@ The phone number must match the specified country code. For example, for a China
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | --------------------------- | ---- | ----------------------------------------------------- | | ----------- | --------------------------- | ---- | ----------------------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | | countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -491,16 +490,16 @@ All country codes are supported. ...@@ -491,16 +490,16 @@ All country codes are supported.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------- | | ----------- | ------ | ---- | ---------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.| | countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------------------------ | | --------------------- | ------------------------------------------------------------ |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -521,7 +520,7 @@ Provides an option for determining whether a call is a video call. ...@@ -521,7 +520,7 @@ Provides an option for determining whether a call is a video call.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory| Description | | Name| Type | Mandatory | Description |
| ------ | ------- | ---- | ------------------------------------------------------------ | | ------ | ------- | ---- | ------------------------------------------------------------ |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call| | extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
...@@ -536,7 +535,7 @@ Enumerates call states. ...@@ -536,7 +535,7 @@ Enumerates call states.
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | | CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. |
| CALL_STATE_IDLE | 0 | No call is in progress. | | CALL_STATE_IDLE | 0 | No call is in progress. |
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | | CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. |
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.| | CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. |
## EmergencyNumberOptions<sup>7+</sup> ## EmergencyNumberOptions<sup>7+</sup>
...@@ -544,7 +543,7 @@ Provides an option for determining whether a number is an emergency number for t ...@@ -544,7 +543,7 @@ Provides an option for determining whether a number is an emergency number for t
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory| Description | | Name| Type | Mandatory | Description |
| ------ | ------ | ---- | ---------------------------------------------- | | ------ | ------ | ---- | ---------------------------------------------- |
| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
...@@ -554,6 +553,6 @@ Provides an option for number formatting. ...@@ -554,6 +553,6 @@ Provides an option for number formatting.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------------------------------------------------- | | ----------- | ------ | ---- | ---------------------------------------------------------- |
| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.| | countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. |
...@@ -465,8 +465,6 @@ selectContact(callback: AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void ...@@ -465,8 +465,6 @@ selectContact(callback: AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void
Selects a contact. This API uses an asynchronous callback to return the result. Selects a contact. This API uses an asynchronous callback to return the result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**Permission required**: ohos.permission.READ_CONTACTS **Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData **System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData
...@@ -495,8 +493,6 @@ selectContact(): Promise&lt;Array&lt;Contact&gt;&gt; ...@@ -495,8 +493,6 @@ selectContact(): Promise&lt;Array&lt;Contact&gt;&gt;
Selects a contact. This API uses a promise to return the result. Selects a contact. This API uses a promise to return the result.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.
**Permission required**: ohos.permission.READ_CONTACTS **Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData **System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData
......
...@@ -17,7 +17,7 @@ import dataAbility from '@ohos.data.dataAbility'; ...@@ -17,7 +17,7 @@ import dataAbility from '@ohos.data.dataAbility';
createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates
Creates an **RdbPredicates** object based on a **DataAabilityPredicates** object. Creates an **RdbPredicates** object based on a **DataAbilityPredicates** object.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core **System capability**: SystemCapability.DistributedDataManager.DataShare.Core
......
# DataAbilityHelper Module (JavaScript SDK APIs) # DataAbilityHelper Module (JavaScript SDK APIs)
> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE** > **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
```js
import featureAbility from "@ohos.ability.featureAbility";
```
## Usage
Import the following modules based on the actual situation before using the current module:
``` ```
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability' import ohos_data_ability from '@ohos.data.dataAbility'
import ohos_data_rdb from '@ohos.data.rdb' import ohos_data_rdb from '@ohos.data.rdb'
``` ```
...@@ -499,7 +506,7 @@ const valueBucket = { ...@@ -499,7 +506,7 @@ const valueBucket = {
"name": "rose", "name": "rose",
"age": 22, "age": 22,
"salary": 200.5, "salary": 200.5,
"blobType": u8, "blobType": "u8",
} }
DAHelper.insert( DAHelper.insert(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
...@@ -541,7 +548,7 @@ const valueBucket = { ...@@ -541,7 +548,7 @@ const valueBucket = {
"name": "rose1", "name": "rose1",
"age": 221, "age": 221,
"salary": 20.5, "salary": 20.5,
"blobType": u8, "blobType": "u8",
} }
DAHelper.insert( DAHelper.insert(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
...@@ -574,9 +581,9 @@ import featureAbility from '@ohos.ability.featureAbility' ...@@ -574,9 +581,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper( var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": u8,}, var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": u8,}, {"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": u8,}) {"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",})
DAHelper.batchInsert( DAHelper.batchInsert(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
cars, cars,
...@@ -613,9 +620,9 @@ import featureAbility from '@ohos.ability.featureAbility' ...@@ -613,9 +620,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper( var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": u8,}, var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": u8,}, {"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": u8,}) {"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",})
DAHelper.batchInsert( DAHelper.batchInsert(
"dataability:///com.example.DataAbility", "dataability:///com.example.DataAbility",
cars cars
...@@ -682,6 +689,7 @@ Deletes one or more data records from the database. This API uses a promise to r ...@@ -682,6 +689,7 @@ Deletes one or more data records from the database. This API uses a promise to r
```js ```js
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper( var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility" "dataability:///com.example.DataAbility"
); );
...@@ -723,7 +731,7 @@ const va = { ...@@ -723,7 +731,7 @@ const va = {
"name": "roe1", "name": "roe1",
"age": 21, "age": 21,
"salary": 20.5, "salary": 20.5,
"blobType": u8, "blobType": "u8",
} }
let da = new ohos_data_ability.DataAbilityPredicates() let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.update( DAHelper.update(
...@@ -769,7 +777,7 @@ const va = { ...@@ -769,7 +777,7 @@ const va = {
"name": "roe1", "name": "roe1",
"age": 21, "age": 21,
"salary": 20.5, "salary": 20.5,
"blobType": u8, "blobType": "u8",
} }
let da = new ohos_data_ability.DataAbilityPredicates() let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.update( DAHelper.update(
......
# Fault Logger # Fault Logger
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -15,12 +15,12 @@ Enumerates the fault types. ...@@ -15,12 +15,12 @@ Enumerates the fault types.
**System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger **System capability**: SystemCapability.HiviewDFX.Hiview.FaultLogger
| Name | Default Value | Description | | Name| Default Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| NO_SPECIFIC | 0 | No specific fault type. | | NO_SPECIFIC | 0 | No specific fault type.|
| CPP_CRASH | 2 | C++ program crash. | | CPP_CRASH | 2 | C++ program crash.|
| JS_CRASH | 3 | JS program crash. | | JS_CRASH | 3 | JS program crash.|
| APP_FREEZE | 4 | Application freezing. | | APP_FREEZE | 4 | Application freezing.|
## FaultLogInfo ## FaultLogInfo
...@@ -30,14 +30,14 @@ Defines the data structure of the fault log information. ...@@ -30,14 +30,14 @@ Defines the data structure of the fault log information.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| pid | number | Process ID of the faulty process. | | pid | number | Process ID of the faulty process.|
| uid | number | User ID of the faulty process. | | uid | number | User ID of the faulty process.|
| type | [FaultType](#faulttype) | Fault type. | | type | [FaultType](#faulttype) | Fault type.|
| timestamp | number | Second-level timestamp when the log was generated. | | timestamp | number | Second-level timestamp when the log was generated.|
| reason | string | Reason for the fault. | | reason | string | Reason for the fault.|
| module | string | Module on which the fault occurred. | | module | string | Module on which the fault occurred.|
| summary | string | Summary of the fault. | | summary | string | Summary of the fault.|
| fullLog | string | Full log text. | | fullLog | string | Full log text.|
## faultLogger.querySelfFaultLog ## faultLogger.querySelfFaultLog
...@@ -51,7 +51,7 @@ Obtains the fault information about the current process. This API uses an asynch ...@@ -51,7 +51,7 @@ Obtains the fault information about the current process. This API uses an asynch
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faulttype) | Yes| Fault type. | | faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned. | callback | AsyncCallbackArray&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
**Example** **Example**
...@@ -68,7 +68,7 @@ function queryFaultLogCallback(error, value) { ...@@ -68,7 +68,7 @@ function queryFaultLogCallback(error, value) {
console.info("Log pid: " + value[i].pid); console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid); console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type); console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts); console.info("Log timestamp: " + value[i].timestamp);
console.info("Log reason: " + value[i].reason); console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module); console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary); console.info("Log summary: " + value[i].summary);
...@@ -91,13 +91,13 @@ Obtains the fault information about the current process. This API uses a promise ...@@ -91,13 +91,13 @@ Obtains the fault information about the current process. This API uses a promise
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| faultType | [FaultType](#faulttype) | Yes| Fault type. | | faultType | [FaultType](#faulttype) | Yes| Fault type.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. | | Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
**Example** **Example**
...@@ -112,7 +112,7 @@ async function getLog() { ...@@ -112,7 +112,7 @@ async function getLog() {
console.info("Log pid: " + value[i].pid); console.info("Log pid: " + value[i].pid);
console.info("Log uid: " + value[i].uid); console.info("Log uid: " + value[i].uid);
console.info("Log type: " + value[i].type); console.info("Log type: " + value[i].type);
console.info("Log ts: " + value[i].ts); console.info("Log timestamp: " + value[i].timestamp);
console.info("Log reason: " + value[i].reason); console.info("Log reason: " + value[i].reason);
console.info("Log module: " + value[i].module); console.info("Log module: " + value[i].module);
console.info("Log summary: " + value[i].summary); console.info("Log summary: " + value[i].summary);
......
# FormExtension # FormExtension
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br/>
> 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 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.
Provides **FormExtension** APIs. Provides **FormExtension** APIs.
...@@ -46,6 +46,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been ...@@ -46,6 +46,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
**Example** **Example**
```js ```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension { export default class MyFormExtension extends FormExtension {
onCreate(want) { onCreate(want) {
console.log('FormExtension onCreate, want:' + want.abilityName); console.log('FormExtension onCreate, want:' + want.abilityName);
...@@ -100,6 +101,7 @@ Called to notify the widget provider that a widget has been updated. After obtai ...@@ -100,6 +101,7 @@ Called to notify the widget provider that a widget has been updated. After obtai
**Example** **Example**
```js ```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension { export default class MyFormExtension extends FormExtension {
onUpdate(formId) { onUpdate(formId) {
console.log('FormExtension onUpdate, formId:' + formId); console.log('FormExtension onUpdate, formId:' + formId);
...@@ -130,6 +132,7 @@ Called to notify the widget provider of the change of visibility. ...@@ -130,6 +132,7 @@ Called to notify the widget provider of the change of visibility.
**Example** **Example**
```js ```js
import formBindingData from '@ohos.application.formBindingData'
export default class MyFormExtension extends FormExtension { export default class MyFormExtension extends FormExtension {
onVisibilityChange(newStatus) { onVisibilityChange(newStatus) {
console.log('FormExtension onVisibilityChange, newStatus:' + newStatus); console.log('FormExtension onVisibilityChange, newStatus:' + newStatus);
...@@ -213,9 +216,35 @@ Called when the configuration of the environment where the ability is running is ...@@ -213,9 +216,35 @@ Called when the configuration of the environment where the ability is running is
**Example** **Example**
```js ```js
class MyFormExtension extends MyFormExtension { class MyFormExtension extends FormExtension {
onConfigurationUpdated(config) { onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, config:' + JSON.stringify(config)); console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
} }
} }
``` ```
## FormExtension.onAcquireFormState
onAcquireFormState?(want: Want): formInfo.FormState;
Used by the widget provider to receive the widget state query request. By default, the initial widget state is returned.
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | No| Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension.|
**Example**
```js
import fromInfo from '@ohos.application.fromInfo'
class MyFormExtension extends FormExtension {
onAcquireFormState(want) {
console.log('FormExtension onAcquireFormState, want:' + want);
return fromInfo.FormState.UNKNOWN;
}
}
```
# FormHost # FormHost
> **NOTE**<br/> > **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides APIs related to the widget host. Provides APIs related to the widget host.
...@@ -57,15 +57,15 @@ SystemCapability.Ability.Form ...@@ -57,15 +57,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Parameters** **Parameters**
...@@ -147,16 +147,16 @@ SystemCapability.Ability.Form ...@@ -147,16 +147,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- | | -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. | | formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | No | Whether to release the cache.| | isReleaseCache | boolean | No | Whether to release the cache.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -209,15 +209,15 @@ SystemCapability.Ability.Form ...@@ -209,15 +209,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -270,15 +270,15 @@ SystemCapability.Ability.Form ...@@ -270,15 +270,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -311,7 +311,7 @@ SystemCapability.Ability.Form ...@@ -311,7 +311,7 @@ SystemCapability.Ability.Form
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId, (error, data) => { formHost.notifyVisibleForms(formId, (error, data) => {
if (error.code) { if (error.code) {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
...@@ -337,14 +337,14 @@ SystemCapability.Ability.Form ...@@ -337,14 +337,14 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId).then(() => { formHost.notifyVisibleForms(formId).then(() => {
console.log('formHost notifyVisibleForms success'); console.log('formHost notifyVisibleForms success');
}).catch((error) => { }).catch((error) => {
...@@ -372,7 +372,7 @@ SystemCapability.Ability.Form ...@@ -372,7 +372,7 @@ SystemCapability.Ability.Form
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId, (error, data) => { formHost.notifyInvisibleForms(formId, (error, data) => {
if (error.code) { if (error.code) {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
...@@ -398,14 +398,14 @@ SystemCapability.Ability.Form ...@@ -398,14 +398,14 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId).then(() => { formHost.notifyInvisibleForms(formId).then(() => {
console.log('formHost notifyInvisibleForms success'); console.log('formHost notifyInvisibleForms success');
}).catch((error) => { }).catch((error) => {
...@@ -433,7 +433,7 @@ SystemCapability.Ability.Form ...@@ -433,7 +433,7 @@ SystemCapability.Ability.Form
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId, (error, data) => { formHost.enableFormsUpdate(formId, (error, data) => {
if (error.code) { if (error.code) {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
...@@ -459,14 +459,14 @@ SystemCapability.Ability.Form ...@@ -459,14 +459,14 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId).then(() => { formHost.enableFormsUpdate(formId).then(() => {
console.log('formHost enableFormsUpdate success'); console.log('formHost enableFormsUpdate success');
}).catch((error) => { }).catch((error) => {
...@@ -494,7 +494,7 @@ SystemCapability.Ability.Form ...@@ -494,7 +494,7 @@ SystemCapability.Ability.Form
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId, (error, data) => { formHost.disableFormsUpdate(formId, (error, data) => {
if (error.code) { if (error.code) {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
...@@ -520,14 +520,14 @@ SystemCapability.Ability.Form ...@@ -520,14 +520,14 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId).then(() => { formHost.disableFormsUpdate(formId).then(() => {
console.log('formHost disableFormsUpdate success'); console.log('formHost disableFormsUpdate success');
}).catch((error) => { }).catch((error) => {
...@@ -574,9 +574,9 @@ SystemCapability.Ability.Form ...@@ -574,9 +574,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -591,7 +591,7 @@ SystemCapability.Ability.Form ...@@ -591,7 +591,7 @@ SystemCapability.Ability.Form
## getAllFormsInfo ## getAllFormsInfo
getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void; getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by all applications on the device. This API uses an asynchronous callback to return the result. Obtains the widget information provided by all applications on the device. This API uses an asynchronous callback to return the result.
...@@ -601,9 +601,9 @@ SystemCapability.Ability.Form ...@@ -601,9 +601,9 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -619,7 +619,8 @@ SystemCapability.Ability.Form ...@@ -619,7 +619,8 @@ SystemCapability.Ability.Form
## getAllFormsInfo ## getAllFormsInfo
getAllFormsInfo(): Promise&lt;Array&lt;FormInfo&gt;&gt;; getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by all applications on the device. This API uses a promise to return the result. Obtains the widget information provided by all applications on the device. This API uses a promise to return the result.
...@@ -645,7 +646,8 @@ SystemCapability.Ability.Form ...@@ -645,7 +646,8 @@ SystemCapability.Ability.Form
## getFormsInfo ## getFormsInfo
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void; getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
...@@ -655,10 +657,10 @@ SystemCapability.Ability.Form ...@@ -655,10 +657,10 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -674,7 +676,8 @@ SystemCapability.Ability.Form ...@@ -674,7 +676,8 @@ SystemCapability.Ability.Form
## getFormsInfo ## getFormsInfo
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;FormInfo&gt;&gt;): void; getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
...@@ -684,11 +687,11 @@ SystemCapability.Ability.Form ...@@ -684,11 +687,11 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | Yes| Module name.| | moduleName | string | Yes| Module name.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -704,7 +707,8 @@ SystemCapability.Ability.Form ...@@ -704,7 +707,8 @@ SystemCapability.Ability.Form
## getFormsInfo ## getFormsInfo
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;FormInfo&gt;&gt;; getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by a given application on the device. This API uses a promise to return the result. Obtains the widget information provided by a given application on the device. This API uses a promise to return the result.
...@@ -714,10 +718,10 @@ SystemCapability.Ability.Form ...@@ -714,10 +718,10 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | No| Module name.| | moduleName | string | No| Module name.|
**Return value** **Return value**
...@@ -767,7 +771,7 @@ SystemCapability.Ability.Form ...@@ -767,7 +771,7 @@ SystemCapability.Ability.Form
## deleteInvalidForms ## deleteInvalidForms
function deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;; deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;;
Deletes invalid widgets from the list. This API uses a promise to return the result. Deletes invalid widgets from the list. This API uses a promise to return the result.
...@@ -800,7 +804,7 @@ SystemCapability.Ability.Form ...@@ -800,7 +804,7 @@ SystemCapability.Ability.Form
## acquireFormState ## acquireFormState
acquireFormState(want: Want, callback: AsyncCallback&lt;FormStateInfo&gt;): void; acquireFormState(want: Want, callback: AsyncCallback&lt;formInfo.FormStateInfo&gt;): void;
Obtains the widget state. This API uses an asynchronous callback to return the result. Obtains the widget state. This API uses an asynchronous callback to return the result.
...@@ -820,8 +824,13 @@ SystemCapability.Ability.Form ...@@ -820,8 +824,13 @@ SystemCapability.Ability.Form
```js ```js
var want = { var want = {
"deviceId": "", "deviceId": "",
"bundleName": "com.extreme.test", "bundleName": "ohos.samples.FormApplication",
"abilityName": "com.extreme.test.MainAbility" "abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
}; };
formHost.acquireFormState(want, (error, data) => { formHost.acquireFormState(want, (error, data) => {
if (error.code) { if (error.code) {
...@@ -834,7 +843,7 @@ SystemCapability.Ability.Form ...@@ -834,7 +843,7 @@ SystemCapability.Ability.Form
## acquireFormState ## acquireFormState
function acquireFormState(want: Want): Promise&lt;FormStateInfo&gt;; acquireFormState(want: Want): Promise&lt;formInfo.FormStateInfo&gt;;
Obtains the widget state. This API uses a promise to return the result. Obtains the widget state. This API uses a promise to return the result.
...@@ -859,8 +868,13 @@ SystemCapability.Ability.Form ...@@ -859,8 +868,13 @@ SystemCapability.Ability.Form
```js ```js
var want = { var want = {
"deviceId": "", "deviceId": "",
"bundleName": "com.extreme.test", "bundleName": "ohos.samples.FormApplication",
"abilityName": "com.extreme.test.MainAbility" "abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
}; };
formHost.acquireFormState(want).then((data) => { formHost.acquireFormState(want).then((data) => {
console.log('formHost acquireFormState, data:' + JSON.stringify(data)); console.log('formHost acquireFormState, data:' + JSON.stringify(data));
...@@ -962,16 +976,16 @@ SystemCapability.Ability.Form ...@@ -962,16 +976,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.| | formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.| | isVisible | boolean | Yes | Whether to be visible.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -1025,16 +1039,16 @@ SystemCapability.Ability.Form ...@@ -1025,16 +1039,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.| | formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isEnableUpdate | boolean | Yes | Whether to enable update.| | isEnableUpdate | boolean | Yes | Whether to enable update.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
......
...@@ -80,7 +80,7 @@ SystemCapability.Ability.Form ...@@ -80,7 +80,7 @@ SystemCapability.Ability.Form
## updateForm ## updateForm
updateForm(formId: string, formBindingData: FormBindingData, callback: AsyncCallback&lt;void&gt;): void; updateForm(formId: string, formBindingData: formBindingData.FormBindingData,callback: AsyncCallback&lt;void&gt;): void;
Updates a widget. This API uses an asynchronous callback to return the result. Updates a widget. This API uses an asynchronous callback to return the result.
...@@ -111,7 +111,7 @@ SystemCapability.Ability.Form ...@@ -111,7 +111,7 @@ SystemCapability.Ability.Form
## updateForm ## updateForm
updateForm(formId: string, formBindingData: FormBindingData): Promise&lt;void&gt;; updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise&lt;void&gt;;
Updates a widget. This API uses a promise to return the result. Updates a widget. This API uses a promise to return the result.
......
...@@ -98,7 +98,7 @@ Obtains a collection of thread, process, and alarm rules that have been added. ...@@ -98,7 +98,7 @@ Obtains a collection of thread, process, and alarm rules that have been added.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Obtain the collection of added rules. // Obtain the collection of added rules.
hichecker.getRule(); // return 1n; hichecker.getRule(); // Return 1n.
``` ```
## hichecker.contains ## hichecker.contains
...@@ -119,7 +119,7 @@ Checks whether the specified rule exists in the collection of added rules. If th ...@@ -119,7 +119,7 @@ Checks whether the specified rule exists in the collection of added rules. If th
| Type | Description | | Type | Description |
| ------- | ---------------------------------------------------------- | | ------- | ---------------------------------------------------------- |
| boolean | Returns **true** if the rule exists in the collection of added rules; returns **false** otherwise.| | boolean | Returns **true** if the rule exists in the collection of added rules; returns **false** otherwise. |
**Example** **Example**
...@@ -128,6 +128,6 @@ Checks whether the specified rule exists in the collection of added rules. If th ...@@ -128,6 +128,6 @@ Checks whether the specified rule exists in the collection of added rules. If th
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
// Check whether the added rule exists in the collection of added rules. // Check whether the added rule exists in the collection of added rules.
hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true; hichecker.contains(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // Return true
hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // return false; hichecker.contains(hichecker.RULE_CAUTION_PRINT_LOG); // Return false
``` ```
...@@ -26,15 +26,15 @@ Registers a listener to observe the mission status. ...@@ -26,15 +26,15 @@ Registers a listener to observe the mission status.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| listener | MissionListener | Yes| Listener to register.| | listener | MissionListener | Yes| Listener to register.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Returns the unique index of the mission status listener, which is created by the system and allocated when the listener is registered.| | number | Returns the unique index of the mission status listener, which is created by the system and allocated when the listener is registered.|
**Example** **Example**
...@@ -62,10 +62,10 @@ Deregisters a mission status listener. This API uses an asynchronous callback to ...@@ -62,10 +62,10 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.| | listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -96,15 +96,15 @@ Deregisters a mission status listener. This API uses a promise to return the res ...@@ -96,15 +96,15 @@ Deregisters a mission status listener. This API uses a promise to return the res
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.| | listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -135,11 +135,11 @@ Obtains the information about a given mission. This API uses an asynchronous cal ...@@ -135,11 +135,11 @@ Obtains the information about a given mission. This API uses an asynchronous cal
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionInfo](#missioninfo)&gt; | Yes| Callback used to return the mission information obtained.| | callback | AsyncCallback&lt;[MissionInfo](#missioninfo)&gt; | Yes| Callback used to return the mission information obtained.|
**Example** **Example**
...@@ -169,16 +169,16 @@ Obtains the information about a given mission. This API uses a promise to return ...@@ -169,16 +169,16 @@ Obtains the information about a given mission. This API uses a promise to return
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[MissionInfo](#missioninfo)&gt; | Promise used to return the mission information obtained.| | Promise&lt;[MissionInfo](#missioninfo)&gt; | Promise used to return the mission information obtained.|
**Example** **Example**
...@@ -201,11 +201,11 @@ Obtains information about all missions. This API uses an asynchronous callback t ...@@ -201,11 +201,11 @@ Obtains information about all missions. This API uses an asynchronous callback t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.| | numMax | number | Yes| Maximum number of missions whose information can be obtained.|
| callback | AsyncCallback&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Yes| Callback used to return the array of mission information obtained.| | callback | AsyncCallback&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Yes| Callback used to return the array of mission information obtained.|
**Example** **Example**
...@@ -230,16 +230,16 @@ Obtains information about all missions. This API uses a promise to return the re ...@@ -230,16 +230,16 @@ Obtains information about all missions. This API uses a promise to return the re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| numMax | number | Yes| Maximum number of missions whose information can be obtained.| | numMax | number | Yes| Maximum number of missions whose information can be obtained.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Promise used to return the array of mission information obtained.| | Promise&lt;Array&lt;[MissionInfo](#missioninfo)&gt;&gt; | Promise used to return the array of mission information obtained.|
**Example** **Example**
...@@ -262,11 +262,11 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback ...@@ -262,11 +262,11 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Yes| Callback used to return the snapshot information obtained.| | callback | AsyncCallback&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Yes| Callback used to return the snapshot information obtained.|
**Example** **Example**
...@@ -297,16 +297,16 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r ...@@ -297,16 +297,16 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Promise used to return the snapshot information obtained.| | Promise&lt;[MissionSnapshot](js-apis-application-MissionSnapshot.md)&gt; | Promise used to return the snapshot information obtained.|
**Example** **Example**
...@@ -337,10 +337,10 @@ Locks a given mission. This API uses an asynchronous callback to return the resu ...@@ -337,10 +337,10 @@ Locks a given mission. This API uses an asynchronous callback to return the resu
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -370,15 +370,15 @@ Locks a given mission. This API uses a promise to return the result. ...@@ -370,15 +370,15 @@ Locks a given mission. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -441,15 +441,15 @@ Unlocks a given mission. This API uses a promise to return the result. ...@@ -441,15 +441,15 @@ Unlocks a given mission. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -483,10 +483,10 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy ...@@ -483,10 +483,10 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -516,15 +516,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom ...@@ -516,15 +516,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -574,9 +574,9 @@ Clears all unlocked missions. This API uses a promise to return the result. ...@@ -574,9 +574,9 @@ Clears all unlocked missions. This API uses a promise to return the result.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -598,10 +598,10 @@ Switches a given mission to the foreground. This API uses an asynchronous callba ...@@ -598,10 +598,10 @@ Switches a given mission to the foreground. This API uses an asynchronous callba
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -631,11 +631,11 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -631,11 +631,11 @@ Switches a given mission to the foreground, with the startup parameters for the
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -665,16 +665,16 @@ Switches a given mission to the foreground, with the startup parameters for the ...@@ -665,16 +665,16 @@ Switches a given mission to the foreground, with the startup parameters for the
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -709,4 +709,4 @@ Describes the mission information. ...@@ -709,4 +709,4 @@ Describes the mission information.
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.| | want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.| | label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.| | iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission is continuable.| | continuable | boolean | Yes| Yes| Whether the mission can be continued on another device. |
# ProcessRunningInfo # ProcessRunningInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides process running information. Provides process running information.
## Modules to Import
```js
import appManager from '@ohos.application.appManager'
```
## Usage ## Usage
......
# System Parameter # System Parameter
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
>
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - This is a system API and cannot be called by third-party applications. > - This is a system API and cannot be called by third-party applications.
...@@ -24,7 +25,7 @@ Obtains the value of the attribute with the specified key. ...@@ -24,7 +25,7 @@ Obtains the value of the attribute with the specified key.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.| | key | string | Yes| Key of the system attribute.|
| def | string | No| Default Value| | def | string | No| Default value.|
**Return value** **Return value**
...@@ -48,7 +49,7 @@ try { ...@@ -48,7 +49,7 @@ try {
get(key: string, callback: AsyncCallback&lt;string&gt;): void get(key: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result. Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SysInfo
...@@ -79,7 +80,7 @@ try { ...@@ -79,7 +80,7 @@ try {
get(key: string, def: string, callback: AsyncCallback&lt;string&gt;): void get(key: string, def: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the value of the attribute with the specified key. This API uses an asynchronous callback to return the result. Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SysInfo
...@@ -112,7 +113,7 @@ try { ...@@ -112,7 +113,7 @@ try {
get(key: string, def?: string): Promise&lt;string&gt; get(key: string, def?: string): Promise&lt;string&gt;
Obtains the value of the attribute with the specified key. This API uses a promise to return the result. Obtains the value of the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SysInfo
...@@ -171,11 +172,11 @@ try { ...@@ -171,11 +172,11 @@ try {
``` ```
## parameter.set(key: string, value: string, callback: AsyncCallback&lt;void&gt;) ## parameter.set
set(key: string, value: string, callback: AsyncCallback&lt;void&gt;): void set(key: string, value: string, callback: AsyncCallback&lt;void&gt;): void
Sets a value for the attribute with the specified key. This API uses an asynchronous callback to return the result. Sets a value for the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SysInfo
...@@ -184,7 +185,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro ...@@ -184,7 +185,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.| | key | string | Yes| Key of the system attribute.|
| def | string | Yes| Default Value| | value | string | Yes| System attribute value to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -203,11 +204,11 @@ try { ...@@ -203,11 +204,11 @@ try {
``` ```
## parameter.set(key: string, def?: string) ## parameter.set
set(key: string, def?: string): Promise&lt;string&gt; set(key: string, value: string): Promise&lt;void&gt;
Sets a value for the attribute with the specified key. This API uses a promise to return the result. Sets a value for the attribute with the specified key.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SysInfo
...@@ -216,13 +217,13 @@ Sets a value for the attribute with the specified key. This API uses a promise t ...@@ -216,13 +217,13 @@ Sets a value for the attribute with the specified key. This API uses a promise t
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the system attribute.| | key | string | Yes| Key of the system attribute.|
| def | string | No| Default Value| | value| string | Yes| System attribute value to set.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the execution result.| | Promise&lt;void&gt; | Promise used to return the execution result.|
**Example** **Example**
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
>![](public_sys-resources/icon-note.gif) **NOTE:** >![](public_sys-resources/icon-note.gif) **NOTE:**
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
>Newly added APIs are defined but not implemented in OpenHarmony 3.1 Release. They will be available for use in OpenHarmony 3.1 MR.
You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the [createWebSocket](#websocketcreatewebsocket) API to create a [WebSocket](#websocket) object and then use the [connect](#connect) API to connect to the server. If the connection is successful, the client will receive a callback of the [open](#onopen) event. Then, the client can communicate with the server using the [send](#send) API. When the server sends a message to the client, the client will receive a callback of the [message](#onmessage) event. If the client no longer needs this connection, it can call the [close](#close) API to disconnect from the server. Then, the client will receive a callback of the [close](#onclose) event. You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the [createWebSocket](#websocketcreatewebsocket) API to create a [WebSocket](#websocket) object and then use the [connect](#connect) API to connect to the server. If the connection is successful, the client will receive a callback of the [open](#onopen) event. Then, the client can communicate with the server using the [send](#send) API. When the server sends a message to the client, the client will receive a callback of the [message](#onmessage) event. If the client no longer needs this connection, it can call the [close](#close) API to disconnect from the server. Then, the client will receive a callback of the [close](#onclose) event.
......
...@@ -58,10 +58,10 @@ Describes the properties of the status bar and navigation bar. ...@@ -58,10 +58,10 @@ Describes the properties of the status bar and navigation bar.
| Name | Type| Readable| Writable| Description | | Name | Type| Readable| Writable| Description |
| -------------------------------------- | -------- | ---- | ---- | ------------------------------------------------------------ | | -------------------------------------- | -------- | ---- | ---- | ------------------------------------------------------------ |
| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| | statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| isStatusBarLightIcon<sup>7+</sup> | boolean | No | Yes | Whether any icon on the status bar is highlighted. | | isStatusBarLightIcon<sup>7+</sup> | boolean | No | Yes | Whether any icon on the status bar is highlighted. |
| statusBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the status bar. | | statusBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the status bar. |
| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| | navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| isNavigationBarLightIcon<sup>7+</sup> | boolean | No | No | Whether any icon on the navigation bar is highlighted. | | isNavigationBarLightIcon<sup>7+</sup> | boolean | No | No | Whether any icon on the navigation bar is highlighted. |
| navigationBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the navigation bar. | | navigationBarContentColor<sup>8+</sup> | string | No | Yes | Color of the text on the navigation bar. |
...@@ -78,7 +78,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -78,7 +78,7 @@ This is a system API and cannot be called by third-party applications.
| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.| | type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.|
| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. | | isEnable | boolean | Yes | Yes | Whether the system bar is displayed. |
| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. | | region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. |
| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| | backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **\#00FF00** or **\#FF00FF00**.|
| contentColor | string | Yes | Yes | Color of the text on the system bar. | | contentColor | string | Yes | Yes | Color of the text on the system bar. |
## SystemBarTintState<sup>8+</sup> ## SystemBarTintState<sup>8+</sup>
...@@ -146,6 +146,7 @@ Describes the window properties. ...@@ -146,6 +146,7 @@ Describes the window properties.
| focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. | | focusable<sup>7+</sup> | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. |
| touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. | | touchable<sup>7+</sup> | boolean | Yes | No | Whether the window is touchable. The default value is **true**. |
| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness. | | brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness. |
| dimBehindValue<sup>(deprecated)</sup> | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.<br>This attribute is supported since API version 7 and deprecated since API version 9.<br> |
| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**. | | isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**. |
| isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**. | | isPrivacyMode<sup>7+</sup> | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**. |
| isRoundCorner<sup>7+</sup> | boolean | Yes | Yes | Whether the window has rounded corners. The default value is **false**. | | isRoundCorner<sup>7+</sup> | boolean | Yes | Yes | Whether the window has rounded corners. The default value is **false**. |
...@@ -168,7 +169,7 @@ create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): voi ...@@ -168,7 +169,7 @@ create(id: string, type: WindowType, callback: AsyncCallback&lt;Window&gt;): voi
Creates a subwindow. This API uses an asynchronous callback to return the result. Creates a subwindow. This API uses an asynchronous callback to return the result.
This API is discarded since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead. This API is deprecated since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -201,7 +202,7 @@ create(id: string, type: WindowType): Promise&lt;Window&gt; ...@@ -201,7 +202,7 @@ create(id: string, type: WindowType): Promise&lt;Window&gt;
Creates a subwindow. This API uses a promise to return the result. Creates a subwindow. This API uses a promise to return the result.
This API is discarded since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead. This API is deprecated since API version 8. You are advised to use [window.create<sup>8+</sup>](#windowcreate8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -370,7 +371,7 @@ getTopWindow(callback: AsyncCallback&lt;Window&gt;): void ...@@ -370,7 +371,7 @@ getTopWindow(callback: AsyncCallback&lt;Window&gt;): void
Obtains the top window of the current application. This API uses an asynchronous callback to return the result. Obtains the top window of the current application. This API uses an asynchronous callback to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead. This API is deprecated since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -400,7 +401,7 @@ getTopWindow(): Promise&lt;Window&gt; ...@@ -400,7 +401,7 @@ getTopWindow(): Promise&lt;Window&gt;
Obtains the top window of the current application. This API uses a promise to return the result. Obtains the top window of the current application. This API uses a promise to return the result.
This API is discarded since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead. This API is deprecated since API version 8. You are advised to use [window.getTopWindow<sup>8+</sup>](#windowgettopwindow8) instead.
**System capability**: SystemCapability.WindowManager.WindowManager.Core **System capability**: SystemCapability.WindowManager.WindowManager.Core
...@@ -707,9 +708,9 @@ Moves this window. This API uses an asynchronous callback to return the result. ...@@ -707,9 +708,9 @@ Moves this window. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | --------------------------------------- | | -------- | ------------------------- | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.| | x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.| | y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example** **Example**
...@@ -736,9 +737,9 @@ Moves this window. This API uses a promise to return the result. ...@@ -736,9 +737,9 @@ Moves this window. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | --------------------------------------- | | ------ | ------ | ---- | ------------------------------------------------- |
| x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.| | x | number | Yes | Distance that the window moves along the x-axis, in px. A positive value indicates that the window moves to the right.|
| y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.| | y | number | Yes | Distance that the window moves along the y-axis, in px. A positive value indicates that the window moves downwards.|
**Return value** **Return value**
...@@ -768,9 +769,9 @@ Changes the size of this window. This API uses an asynchronous callback to retur ...@@ -768,9 +769,9 @@ Changes the size of this window. This API uses an asynchronous callback to retur
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------- | | -------- | ------------------------- | ---- | -------------------------- |
| width | number | Yes | New width of the window.| | width | number | Yes | New width of the window, in px.|
| height | number | Yes | New height of the window.| | height | number | Yes | New height of the window, in px.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example** **Example**
...@@ -796,9 +797,9 @@ Changes the size of this window. This API uses a promise to return the result. ...@@ -796,9 +797,9 @@ Changes the size of this window. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- | | ------ | ------ | ---- | -------------------------- |
| width | number | Yes | New width of the window.| | width | number | Yes | New width of the window, in px.|
| height | number | Yes | New height of the window.| | height | number | Yes | New height of the window, in px.|
**Return value** **Return value**
...@@ -1601,7 +1602,7 @@ Sets this window to the wide or default color gamut mode. This API uses a promis ...@@ -1601,7 +1602,7 @@ Sets this window to the wide or default color gamut mode. This API uses a promis
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in setting window colorspace. Data: ' + JSON.stringify(data)) console.info('Succeeded in setting window colorspace. Data: ' + JSON.stringify(data))
}).catch((err)=>{ }).catch((err)=>{
console.error('Failed to set window colorspacet. Cause: ' + JSON.stringify(err)); console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err));
}); });
``` ```
...@@ -1624,10 +1625,10 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb ...@@ -1624,10 +1625,10 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb
```js ```js
windowClass.getColorSpace((err, data) => { windowClass.getColorSpace((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to get window color space. Cause:' + JSON.stringify(err)); console.error('Failed to get window colorspace. Cause:' + JSON.stringify(err));
return; return;
} }
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data)) console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data))
}) })
``` ```
...@@ -1652,7 +1653,7 @@ Obtains the color gamut mode of this window. This API uses a promise to return t ...@@ -1652,7 +1653,7 @@ Obtains the color gamut mode of this window. This API uses a promise to return t
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data)) console.info('Succeeded in getting window color space. Cause:' + JSON.stringify(data))
}).catch((err)=>{ }).catch((err)=>{
console.error('Failed to set window colorspacet. Cause: ' + JSON.stringify(err)); console.error('Failed to get window colorspace. Cause: ' + JSON.stringify(err));
}); });
``` ```
...@@ -1668,7 +1669,7 @@ Sets the background color for this window. This API uses an asynchronous callbac ...@@ -1668,7 +1669,7 @@ Sets the background color for this window. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.| | color | string | Yes | Background color to set. The value is a hexadecimal color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example** **Example**
...@@ -1696,7 +1697,7 @@ Sets the background color for this window. This API uses a promise to return the ...@@ -1696,7 +1697,7 @@ Sets the background color for this window. This API uses a promise to return the
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.| | color | string | Yes | Background color to set. The value is a hexadecimal color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**.|
**Return value** **Return value**
...@@ -1776,6 +1777,70 @@ Sets the screen brightness for this window. This API uses a promise to return th ...@@ -1776,6 +1777,70 @@ Sets the screen brightness for this window. This API uses a promise to return th
}); });
``` ```
### setDimBehind<sup>(deprecated)</sup>
setDimBehind(dimBehindValue: number, callback: AsyncCallback&lt;void&gt;): void
Sets the dimness of the window that is not on top. This API uses an asynchronous callback to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------------- | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
```js
windowClass.setDimBehind(0.5, (err, data) => {
if (err.code) {
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the dimness. Data:' + JSON.stringify(data));
});
```
### setDimBehind<sup>(deprecated)</sup>
setDimBehind(dimBehindValue: number): Promise&lt;void&gt;
Sets the dimness of the window that is not on top. This API uses a promise to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | -------------------------------------------------- |
| dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.|
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```js
let promise = windowClass.setDimBehind(0.5);
promise.then((data)=> {
console.info('Succeeded in setting the dimness. Data: ' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err));
});
```
### setFocusable<sup>7+</sup> ### setFocusable<sup>7+</sup>
setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void setFocusable(isFocusable: boolean, callback: AsyncCallback&lt;void&gt;): void
...@@ -1864,6 +1929,70 @@ Sets whether to keep the screen always on. This API uses an asynchronous callbac ...@@ -1864,6 +1929,70 @@ Sets whether to keep the screen always on. This API uses an asynchronous callbac
}); });
``` ```
### setOutsideTouchable<sup>(deprecated)</sup>
setOutsideTouchable(touchable: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets whether the area outside the subwindow is touchable. This API uses an asynchronous callback to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
**Example**
```js
windowClass.setOutsideTouchable(true, (err, data) => {
if (err.code) {
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
})
```
### setOutsideTouchable<sup>(deprecated)</sup>
setOutsideTouchable(touchable: boolean): Promise&lt;void&gt;
Sets whether the area outside the subwindow is touchable. This API uses a promise to return the result.
> This API is supported since API version 7 and deprecated since API version 9.
>
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ------- | ---- | ---------------- |
| touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.|
**Return value**
| Type | Description |
| ------------------- | ----------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```js
let promise = windowClass.setOutsideTouchable(true);
promise.then((data)=> {
console.info('Succeeded in setting the area to be touchable. Data: ' + JSON.stringify(data))
}).catch((err)=>{
console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err));
});
```
### setKeepScreenOn ### setKeepScreenOn
setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt; setKeepScreenOn(isKeepScreenOn: boolean): Promise&lt;void&gt;
......
# Work Scheduler # Work Scheduler
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br/>
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable. > The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
...@@ -100,7 +100,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return ...@@ -100,7 +100,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
``` ```
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else { } else {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
...@@ -136,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result. ...@@ -136,7 +136,7 @@ Obtains the latest task status. This API uses a promise to return the result.
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
} }
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
}) })
``` ```
...@@ -151,7 +151,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -151,7 +151,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | ------------------------------- | | -------- | -------------------- | ---- | ------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application.| | callback | AsyncCallback\<void> | Yes | Callback used to return all tasks associated with the current application. |
**Return value** **Return value**
...@@ -164,7 +164,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -164,7 +164,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
``` ```
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
} }
...@@ -182,7 +182,7 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -182,7 +182,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
| Type | Description | | Type | Description |
| -------------------------------------- | ------------------------------ | | -------------------------------------- | ------------------------------ |
| Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application.| | Promise<Array\<[WorkInfo](#workinfo)>> | Promise used to return all tasks associated with the current application. |
**Example** **Example**
...@@ -190,7 +190,7 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -190,7 +190,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
}) })
``` ```
...@@ -233,7 +233,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -233,7 +233,7 @@ Checks whether the last execution of the specified task timed out. This API uses
``` ```
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
} }
...@@ -267,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -267,7 +267,7 @@ Checks whether the last execution of the specified task timed out. This API uses
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}) })
.catch(err => { .catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
}); });
``` ```
...@@ -291,6 +291,8 @@ Provides detailed information about the task. ...@@ -291,6 +291,8 @@ Provides detailed information about the task.
| repeatCycleTime | number | No | Repeat interval. | | repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. | | repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType ## NetworkType
Enumerates the network types that can trigger the task. Enumerates the network types that can trigger the task.
...@@ -319,7 +321,7 @@ Enumerates the charging types that can trigger the task. ...@@ -319,7 +321,7 @@ Enumerates the charging types that can trigger the task.
| CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. | | CHARGING_PLUGGED_WIRELESS | 3 | Wireless charging. |
## BatteryStatus ## BatteryStatus
Enumerates the battery status that can trigger the task. Enumerates the battery states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
...@@ -330,7 +332,7 @@ Enumerates the battery status that can trigger the task. ...@@ -330,7 +332,7 @@ Enumerates the battery status that can trigger the task.
| BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.| | BATTERY_STATUS_LOW_OR_OKAY | 2 | The battery level is restored from low to normal, or a low battery alert is displayed.|
## StorageRequest ## StorageRequest
Enumerates the storage status that can trigger the task. Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
- Custom Components - Custom Components
- [Basic Usage](js-components-custom-basic-usage.md) - [Basic Usage](js-components-custom-basic-usage.md)
- [Style Inheritance](js-components-custom-style.md)
- [Custom Events](js-components-custom-events.md) - [Custom Events](js-components-custom-events.md)
- [props](js-components-custom-props.md) - [props](js-components-custom-props.md)
- [Event Parameter](js-components-custom-event-parameter.md) - [Event Parameter](js-components-custom-event-parameter.md)
......
# Style Inheritance
> **NOTE**<br/>
> The APIs of this module are supported since API 9. Updates will be marked with a superscript to indicate their earliest API version.
A custom component has the **inherit-class** attribute, which is defined in the following table.
| Name | Type | Default Value| Mandatory| Description |
| ------------ | ------ | ------ | ---- | ------------------------------------------------------ |
| inherit-class | string | - | No | Class styles inherited from the parent component, seperated by spaces.|
To enable a custom component to inherit the styles of its parent component, set the **inherit-calss** attribute for the custom component.
The example below is a code snippet in the HML file of the parent page that references a custom component named **comp**. This component uses the **inherit-class** attribute to inherit the styles of its parent component: **parent-class1** and **parent-class2**.
```html
<!-- xxx.hml -->
<element name='comp' src='../../common/component/comp.hml'></element>
<div class="container">
<comp inherit-class="parent-class1 parent-class2" ></comp>
</div>
```
Code snippet in the CSS file of the parent page:
```html
// xxx.css
.parent-class1 {
background-color:red;
border:2px;
}
.parent-class2 {
background-color:green;
border:2px;
}
```
Code snippet in the HML file of the custom component, where **parent-class1** and **parent-class2** are styles inherited from the parent component:
```html
<!--comp.hml-->
<div class="item">
<text class="parent-class1">Style 1 inherited from the parent component</text>
<text class="parent-class2">Style 2 inherited from the parent component</text>
</div>
```
...@@ -29,11 +29,11 @@ Creates a component that can automatically display the navigation bar, title, an ...@@ -29,11 +29,11 @@ Creates a component that can automatically display the navigation bar, title, an
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| title | string \| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Page title. | | title | string \| [CustomBuilder](../../ui/ts-types.md) | - | Page title. |
| subtitle | string | - | Subtitle of the page. | | subtitle | string | - | Subtitle of the page. |
| menus | Array&lt;NavigationMenuItem&gt; \| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Menu in the upper right corner of the page. | | menus | Array&lt;NavigationMenuItem&gt; \| [CustomBuilder](../../ui/ts-types.md) | - | Menu in the upper right corner of the page. |
| titleMode | NavigationTitleMode | NavigationTitleMode.Free | Display mode of the page title bar. | | titleMode | NavigationTitleMode | NavigationTitleMode.Free | Display mode of the page title bar. |
| toolBar | {<br/>items:[<br/>Object<br/>] }<br/>\| [CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | Content of the toolbar.<br/>**items**: all items on the toolbar. | | toolBar | {<br/>items:[<br/>Object<br/>] }<br/>\| [CustomBuilder](../../ui/ts-types.md) | - | Content of the toolbar.<br/>**items**: all items on the toolbar. |
| hideToolBar | boolean | false | Whether to hide the toolbar.<br/>**true**: Hide the toolbar.<br/>**false**: Show the toolbar. | | hideToolBar | boolean | false | Whether to hide the toolbar.<br/>**true**: Hide the toolbar.<br/>**false**: Show the toolbar. |
| hideTitleBar | boolean | false | Whether to hide the title bar. | | hideTitleBar | boolean | false | Whether to hide the title bar. |
| hideBackButton | boolean | false | Whether to hide the back button. | | hideBackButton | boolean | false | Whether to hide the back button. |
......
...@@ -55,7 +55,7 @@ controller: SearchController = new SearchController() ...@@ -55,7 +55,7 @@ controller: SearchController = new SearchController()
``` ```
#### caretPosition #### caretPosition
creatPosition(value: number): viod creatPosition(value: number): void
Sets the position of the caret. Sets the position of the caret.
......
# Select # Select
> ![](public_sys-resources/icon-note.gif) **NOTE** This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
The **<Select\>** component provides a drop-down list box that allows users to select among multiple options. The **<Select\>** component provides a drop-down list box that allows users to select among multiple options.
...@@ -20,29 +21,29 @@ Select(options: Array\<SelectOption>\) ...@@ -20,29 +21,29 @@ Select(options: Array\<SelectOption>\)
| Name| Type| Mandatory| Default Value| Description| | Name| Type| Mandatory| Default Value| Description|
| ------ | ----------------------------------------------- | ---- | ------ | -------------- | | ------ | ----------------------------------------------- | ---- | ------ | -------------- |
| value | [ResourceStr](../../ui/ts-types.md) | Yes| - | Value of an option in the drop-down list box.| | value | [ResourceStr](../../ui/ts-types.md) | Yes | - | Value of an option in the drop-down list box. |
| icon | [ResourceStr](../../ui/ts-types.md) | No| - | Icon of an option in the drop-down list box.| | icon | [ResourceStr](../../ui/ts-types.md) | No | - | Icon of an option in the drop-down list box. |
## Attributes ## Attributes
| Name| Type| Default Value| Description| | Name| Type| Default Value| Description|
| ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- | | ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- |
| selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.| | selected | number | - | Index of the initial selected option in the drop-down list box. The index of the first option is **0**. |
| value | string | - | Text of the drop-down button.| | value | string | - | Text of the drop-down button. |
| font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button.| | font | [Font](../../ui/ts-types.md) | - | Text font of the drop-down button. |
| fontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the drop-down button.| | fontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the drop-down button. |
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of the selected option in the drop-down list box.| | selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of the selected option in the drop-down list box. |
| selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box.| | selectedOptionFont | [Font](../../ui/ts-types.md) | - | Text font of the selected option in the drop-down list box. |
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the selected option in the drop-down list box.| | selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of the selected option in the drop-down list box. |
| optionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of an option in the drop-down list box.| | optionBgColor | [ResourceColor](../../ui/ts-types.md) | - | Background color of an option in the drop-down list box. |
| optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box.| | optionFont | [Font](../../ui/ts-types.md) | - | Text font of an option in the drop-down list box. |
| optionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of an option in the drop-down list box.| | optionFontColor | [ResourceColor](../../ui/ts-types.md) | - | Text color of an option in the drop-down list box. |
## Events ## Events
| Name| Description| | Name| Description|
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected. **index** indicates the index of the selected option. **value** indicates the value of the selected option.| | onSelect(callback: (index: number, value?:string) => void) | Invoked when an option in the drop-down list box is selected. **index** indicates the index of the selected option. **value** indicates the value of the selected option. |
## Example ## Example
......
# Slider # Slider
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -45,7 +45,7 @@ Slider(value:{value?: number, min?: number, max?: number, step?: number, style?: ...@@ -45,7 +45,7 @@ Slider(value:{value?: number, min?: number, max?: number, step?: number, style?:
Touch target configuration is not supported. Touch target configuration is not supported.
| Name | Type | Default Value | Description | | Name | Type | Default Value | Description |
| ------------- | ------- | ------------- | ---------------------------------------- | | ------------- | ------- | ------------- | -------------------------------------------------------------------- |
| blockColor | Color | - | Color of the slider. | | blockColor | Color | - | Color of the slider. |
| trackColor | Color | - | Background color of the slider. | | trackColor | Color | - | Background color of the slider. |
| selectedColor | Color | - | Color of the slider rail that has been slid. | | selectedColor | Color | - | Color of the slider rail that has been slid. |
......
# Span # Span
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -42,7 +42,7 @@ In addition to the text style attributes, the attributes below are supported. ...@@ -42,7 +42,7 @@ In addition to the text style attributes, the attributes below are supported.
Among all the universal events, only the click event is supported. Among all the universal events, only the click event is supported.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> As the **&lt;Span&gt;** component does not have size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid. > As the **&lt;Span&gt;** component does not have size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid.
......
# Stepper # Stepper
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -36,11 +36,11 @@ None ...@@ -36,11 +36,11 @@ None
## Events ## Events
| Name | Description | | Name | Description |
| -------- | -------- | | -------- | -------- |
| onFinish(callback: () =&gt; void) | Triggered when the **nextLabel** of the last **&lt;StepperItem&gt;** in the **&lt;Stepper&gt;** is clicked. | | onFinish(callback: () =&gt; void) | Invoked when the **nextLabel** of the last **&lt;StepperItem&gt;** in the **&lt;Stepper&gt;** is clicked. |
| onSkip(callback: () =&gt; void) | Triggered when the current **&lt;StepperItem&gt;** is **ItemState.Skip** and the **nextLabel** is clicked. | | onSkip(callback: () =&gt; void) | Invoked when the current **&lt;StepperItem&gt;** is **ItemState.Skip** and the **nextLabel** is clicked. |
| onChange(callback: (prevIndex?: number, index?: number) =&gt; void) | Triggered when the text button on the left or right is clicked to switch between steps.<br/>- **prevIndex**: index of the step page before the switching.<br/>- **index**: index of the step page after the switching, that is, index of the previous or next page. | | onChange(callback: (prevIndex?: number, index?: number) =&gt; void) | Invoked when the text button on the left or right is clicked to switch between steps.<br/>- **prevIndex**: index of the step page before the switching.<br/>- **index**: index of the step page after the switching, that is, index of the previous or next page. |
## Example ## Example
......
...@@ -103,7 +103,7 @@ scroller.currentOffset(): Object ...@@ -103,7 +103,7 @@ scroller.currentOffset(): Object
Obtains the scrolling offset. Obtains the scrolling offset.
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| {<br/>xOffset: number,<br/>yOffset: number<br/>} | **xOffset**: horizontal scrolling offset.<br/>**yOffset**: vertical scrolling offset. | | {<br/>xOffset: number,<br/>yOffset: number<br/>} | **xOffset**: horizontal scrolling offset.<br/>**yOffset**: vertical scrolling offset. |
......
# Interpolation Calculation # Interpolation Calculation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -31,7 +31,7 @@ Implements initialization for the interpolation curve, which is used to create a ...@@ -31,7 +31,7 @@ Implements initialization for the interpolation curve, which is used to create a
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| curve | Curve | No | Linear | Curve object. | | curve | Curve | No | Linear | Curve object. |
- Return values - Return value<br>
Curve object. Curve object.
...@@ -49,7 +49,7 @@ Constructs a step curve object. ...@@ -49,7 +49,7 @@ Constructs a step curve object.
| count | number | Yes | - | Number of steps. Must be a positive integer. | | count | number | Yes | - | Number of steps. Must be a positive integer. |
| end | boolean | No | true | Step change at the start or end point of each interval. Defaults to **true**, indicating that the step change occurs at the end point. | | end | boolean | No | true | Step change at the start or end point of each interval. Defaults to **true**, indicating that the step change occurs at the end point. |
- Return values - Return value<br>
Curve object. Curve object.
...@@ -69,7 +69,7 @@ Constructs a third-order Bezier curve object. The curve value must be between 0 ...@@ -69,7 +69,7 @@ Constructs a third-order Bezier curve object. The curve value must be between 0
| x2 | number | Yes | Horizontal coordinate of the second point on the Bezier curve. | | x2 | number | Yes | Horizontal coordinate of the second point on the Bezier curve. |
| y2 | number | Yes | Vertical coordinate of the second point on the Bezier curve. | | y2 | number | Yes | Vertical coordinate of the second point on the Bezier curve. |
- Return values - Return value<br>
Curve object. Curve object.
...@@ -89,7 +89,7 @@ Constructs a spring curve object. ...@@ -89,7 +89,7 @@ Constructs a spring curve object.
| stiffness | number | Yes | Stiffness. | | stiffness | number | Yes | Stiffness. |
| damping | number | Yes | Damping. | | damping | number | Yes | Damping. |
- Return values - Return value<br>
Curve object. Curve object.
...@@ -106,7 +106,7 @@ let curve3 = Curves.cubicBezier(0.1, 0.0, 0.1, 1.0) // Create a third-order Bezi ...@@ -106,7 +106,7 @@ let curve3 = Curves.cubicBezier(0.1, 0.0, 0.1, 1.0) // Create a third-order Bezi
Curve objects can be created only by the preceding APIs. Curve objects can be created only by the preceding APIs.
| API | Description | | API | Description |
| -------- | -------- | | -------- | -------- |
| interpolate(time: number): number | Calculation function of the interpolation curve. Passing a normalized time parameter to this function returns the current interpolation.<br/>**time**: indicates the current normalized time. The value ranges from 0 to 1.<br/>The curve interpolation corresponding to the normalized time point is returned. | | interpolate(time: number): number | Calculation function of the interpolation curve. Passing a normalized time parameter to this function returns the current interpolation.<br/>**time**: indicates the current normalized time. The value ranges from 0 to 1.<br/>The curve interpolation corresponding to the normalized time point is returned. |
......
# Matrix Transformation # Matrix Transformation
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
...@@ -31,7 +31,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para ...@@ -31,7 +31,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| array | Array&lt;number&gt; | Yes | [1, 0, 0, 0,<br/>0, 1, 0, 0,<br/>0, 0, 1, 0,<br/>0, 0, 0, 1] | A number array whose length is 16 (4 x 4). For details, see the parameter description. | | array | Array&lt;number&gt; | Yes | [1, 0, 0, 0,<br/>0, 1, 0, 0,<br/>0, 0, 1, 0,<br/>0, 0, 0, 1] | A number array whose length is 16 (4 x 4). For details, see the parameter description. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | 4x4 matrix object created based on the input parameter. | | Object | 4x4 matrix object created based on the input parameter. |
...@@ -76,7 +76,7 @@ identity(): Object ...@@ -76,7 +76,7 @@ identity(): Object
Matrix initialization function. Can return a unit matrix object. Matrix initialization function. Can return a unit matrix object.
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Unit matrix object. | | Object | Unit matrix object. |
...@@ -102,7 +102,7 @@ copy(): Object ...@@ -102,7 +102,7 @@ copy(): Object
Matrix copy function, which is used to copy the current matrix object. Matrix copy function, which is used to copy the current matrix object.
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Copy object of the current matrix. | | Object | Copy object of the current matrix. |
...@@ -151,7 +151,7 @@ Matrix overlay function, which is used to overlay the effects of two matrices to ...@@ -151,7 +151,7 @@ Matrix overlay function, which is used to overlay the effects of two matrices to
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| matrix | Matrix4 | Yes | - | Matrix object to be overlaid. | | matrix | Matrix4 | Yes | - | Matrix object to be overlaid. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Object after matrix overlay. | | Object | Object after matrix overlay. |
...@@ -188,7 +188,7 @@ invert(): Object ...@@ -188,7 +188,7 @@ invert(): Object
Matrix inverse function. Can return an inverse matrix of the current matrix object, that is, get an opposite effect. Matrix inverse function. Can return an inverse matrix of the current matrix object, that is, get an opposite effect.
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Inverse matrix object of the current matrix. | | Object | Inverse matrix object of the current matrix. |
...@@ -219,7 +219,7 @@ Matrix translation function, which is used to add the translation effect to the ...@@ -219,7 +219,7 @@ Matrix translation function, which is used to add the translation effect to the
| z | number | No | 0 | Translation distance of the z-axis, in px. | | z | number | No | 0 | Translation distance of the z-axis, in px. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Matrix object after the translation effect is added. | | Object | Matrix object after the translation effect is added. |
...@@ -263,7 +263,7 @@ Matrix scaling function, which is used to add the scaling effect to the x, y, an ...@@ -263,7 +263,7 @@ Matrix scaling function, which is used to add the scaling effect to the x, y, an
| centerY | number | No | 0 | Y coordinate of the center point. | | centerY | number | No | 0 | Y coordinate of the center point. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Matrix object after the scaling effect is added. | | Object | Matrix object after the scaling effect is added. |
...@@ -308,7 +308,7 @@ Matrix rotation function, which is used to add the rotation effect to the x, y, ...@@ -308,7 +308,7 @@ Matrix rotation function, which is used to add the rotation effect to the x, y,
| centerY | number | No | 0 | Y coordinate of the center point. | | centerY | number | No | 0 | Y coordinate of the center point. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Object | Matrix object after the rotation effect is added. | | Object | Matrix object after the rotation effect is added. |
...@@ -348,7 +348,7 @@ Matrix point transformation function, which is used to apply the current transfo ...@@ -348,7 +348,7 @@ Matrix point transformation function, which is used to apply the current transfo
| point | Point | Yes | - | Point to be transformed. | | point | Point | Yes | - | Point to be transformed. |
- Return values - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | -------- | -------- |
| Point | Point object after matrix transformation | | Point | Point object after matrix transformation |
......
...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -115,7 +115,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
} else { } else {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatuscallback success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatuscallback success,' + item + ' is:' + res[item]);
...@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -131,7 +131,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
} }
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.data); console.info('workschedulerLog getWorkStatus failed, because:' + err.code);
}) })
...@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -141,7 +141,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
} }
...@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -152,7 +152,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.data); console.info('workschedulerLog obtainAllWorks failed, because:' + err.code);
}) })
**Stopping and Clearing Work Scheduler Tasks** **Stopping and Clearing Work Scheduler Tasks**
...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -166,7 +166,7 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
} else { } else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
} }
...@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t ...@@ -179,6 +179,6 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}) })
.catch(err => { .catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code);
}); });
}) })
此差异已折叠。
...@@ -18,8 +18,8 @@ Before subscribing to system events, you need to configure HiSysEvent logging. F ...@@ -18,8 +18,8 @@ Before subscribing to system events, you need to configure HiSysEvent logging. F
| Name| Description | | Name| Description |
| -------- | --------- | | -------- | --------- |
|bool HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener, std::vector&lt;ListenerRule&gt;&amp; rules)|Registers a listener for system events. You can listen for certain events by specifying rules.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </li><li>**rules**: rules for event listening. </li></ul>Return value:<ul><li>**0**: Repeated registration is successful. </li><li>**1**: Initial registration is successful. </li><li>Other values: Registration has failed.</li></ul>| |int32_t HiSysEventManager::AddEventListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener, std::vector&lt;ListenerRule&gt;&amp; rules)|Registers a listener for system events. You can listen for certain events by specifying rules.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </li><li>**rules**: rules for event listening. </li></ul>Return value:<ul><li>**0**: registration is successful. </li><li>Other values: Registration has failed.</li></ul>|
|bool HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener)|Removes the listener for system events.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </ul>Return value:<br>None.| |int32_t HiSysEventManager::RemoveListener(std::shared_ptr&lt;HiSysEventSubscribeCallBack&gt; listener)|Removes the listener for system events.<br><br>Input arguments: <ul><li>**listener**: callback object for system events. </ul>Return value:<ul><li>**0**: Cancel registration is successful. </li><li>Other values: Cancel registration has failed.</li></ul>|
**Table 2** Description of ListenerRule **Table 2** Description of ListenerRule
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册