From 63bf9d3ecd0c23f9e8298a46e6dddc4f4442b6ec Mon Sep 17 00:00:00 2001 From: wusongqing Date: Mon, 6 Jun 2022 14:23:35 +0800 Subject: [PATCH] updated docs Signed-off-by: wusongqing --- .../apis/js-apis-application-ability.md | 163 ++++++++------ .../apis/js-apis-application-missionInfo.md | 28 +++ .../apis/js-apis-dataAbilityHelper.md | 32 +-- .../reference/apis/js-apis-formextension.md | 33 ++- .../reference/apis/js-apis-formhost.md | 200 ++++++++++-------- .../reference/apis/js-apis-formprovider.md | 4 +- .../apis/js-apis-processrunninginfo.md | 7 +- 7 files changed, 292 insertions(+), 175 deletions(-) create mode 100644 en/application-dev/reference/apis/js-apis-application-missionInfo.md diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md index bca94a2813..490bb6eb14 100644 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ b/en/application-dev/reference/apis/js-apis-application-ability.md @@ -3,13 +3,10 @@ > **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. - Manages the ability lifecycle and context. - ## Modules to Import - ``` import Ability from '@ohos.application.Ability'; ``` @@ -18,11 +15,11 @@ import Ability from '@ohos.application.Ability'; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | 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. | - | lastRequestWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters used when the ability was started last time. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| 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.| +| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| ## Ability.onCreate @@ -35,10 +32,10 @@ Called to initialize the service logic when an ability is created. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | 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. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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.| **Example** @@ -61,9 +58,9 @@ Called when a **WindowStage** is created for this ability. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | Yes | **WindowStage** information. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| **Example** @@ -105,9 +102,9 @@ Called when the **WindowStage** is restored during the migration of this ability **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | Yes | **WindowStage** information. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| **Example** @@ -143,7 +140,7 @@ Called when this ability is destroyed to clear resources. 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 @@ -162,7 +159,7 @@ Called when this ability is running in the foreground. 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 @@ -187,24 +184,25 @@ Called to save data during the ability migration preparation process. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | wantParam | {[key: string]: any} | Yes | **want** parameter. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | wantParam | {[key: string]: any} | Yes| **want** parameter.| **Return value** - | Type | Description | - | -------- | -------- | - | AbilityConstant.OnContinueResult | Continuation result. | + | Type| Description| + | -------- | -------- | + | AbilityConstant.OnContinueResult | Continuation result.| **Example** ```js + import AbilityConstant from "@ohos.application.AbilityConstant" class myAbility extends Ability { onContinue(wantParams) { console.log('onContinue'); wantParams["myData"] = "my1234567"; - return true; + return AbilityConstant.OnContinueResult.AGREE; } } ``` @@ -220,9 +218,9 @@ Called when the ability startup mode is set to singleton. **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| **Example** @@ -245,9 +243,9 @@ Called when the configuration of the environment where the ability is running is **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | config | [Configuration](js-apis-configuration.md) | Yes | New configuration. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.| **Example** @@ -259,6 +257,32 @@ Called when the configuration of the environment where the ability is running is } ``` +## Ability.dump + +dump(params: Array\): Array\; + +Called when the client information is dumped. + +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | params | Array\ | Yes| Parameters in the form of a command.| + +**Example** + + ```js + class myAbility extends Ability { + dump(params) { + console.log('dump, params:' + JSON.stringify(params)); + return ["params"] + } + } + ``` + + ## Caller @@ -275,22 +299,25 @@ Sends sequenceable data to the target ability. **Parameters** - | 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. | - | data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | + | 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.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** - | Type | Description | - | -------- | -------- | - | Promise<void> | Promise used to return a response. | + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return a response.| **Example** ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ // Custom sequenceable data structure + name:"" + str:"" + num: 1 constructor(name, str) { this.name = name; this.str = str; @@ -345,22 +372,25 @@ Sends sequenceable data to the target ability and obtains the sequenceable data **Parameters** - | 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. | - | data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. | + | 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.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** - | Type | Description | - | -------- | -------- | - | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability. | + | Type| Description| + | -------- | -------- | + | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.| **Example** ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ + name:"" + str:"" + num: 1 constructor(name, str) { this.name = name; this.str = str; @@ -451,9 +481,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.| **Example** @@ -486,7 +516,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc ## Callee -Implements callbacks for caller notification registration and unregistration. +Implements callbacks for caller notification registration and deregistration. ## Callee.on @@ -499,16 +529,19 @@ Registers a caller notification callback, which is invoked when the target abili **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | 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. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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.| **Example** ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ + name:"" + str:"" + num: 1 constructor(name, str) { this.name = name; this.str = str; @@ -546,15 +579,15 @@ Registers a caller notification callback, which is invoked when the target abili 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 **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | method | string | Yes | Registered notification message string. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Registered notification message string.| **Example** @@ -575,9 +608,9 @@ Unregisters a caller notification callback, which is invoked when the target abi **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | (msg: string) | function | Yes | No | Prototype of the listener function interface registered by the caller. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.| ## CaleeCallBack @@ -586,6 +619,6 @@ Unregisters a caller notification callback, which is invoked when the target abi **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes | No | Prototype of the message listener function interface registered by the callee. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md new file mode 100644 index 0000000000..8371830fe0 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-application-missionInfo.md @@ -0,0 +1,28 @@ +# MissionInfo + +> **NOTE**
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## 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.| diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 10d3684392..1ce0a05d1e 100644 --- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -1,13 +1,20 @@ # DataAbilityHelper Module (JavaScript SDK APIs) -> ![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. ## 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 ohos_data_ability from '@ohos.data.dataability' +import ohos_data_ability from '@ohos.data.dataAbility' import ohos_data_rdb from '@ohos.data.rdb' ``` @@ -499,7 +506,7 @@ const valueBucket = { "name": "rose", "age": 22, "salary": 200.5, - "blobType": u8, + "blobType": "u8", } DAHelper.insert( "dataability:///com.example.DataAbility", @@ -541,7 +548,7 @@ const valueBucket = { "name": "rose1", "age": 221, "salary": 20.5, - "blobType": u8, + "blobType": "u8", } DAHelper.insert( "dataability:///com.example.DataAbility", @@ -574,9 +581,9 @@ import featureAbility from '@ohos.ability.featureAbility' var DAHelper = featureAbility.acquireDataAbilityHelper( "dataability:///com.example.DataAbility" ); -var cars = new Array({"name": "roe11", "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,}) +var cars = new Array({"name": "roe11", "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",}) DAHelper.batchInsert( "dataability:///com.example.DataAbility", cars, @@ -613,9 +620,9 @@ import featureAbility from '@ohos.ability.featureAbility' var DAHelper = featureAbility.acquireDataAbilityHelper( "dataability:///com.example.DataAbility" ); -var cars = new Array({"name": "roe11", "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,}) +var cars = new Array({"name": "roe11", "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",}) DAHelper.batchInsert( "dataability:///com.example.DataAbility", cars @@ -682,6 +689,7 @@ Deletes one or more data records from the database. This API uses a promise to r ```js import featureAbility from '@ohos.ability.featureAbility' +import ohos_data_ability from '@ohos.data.dataability' var DAHelper = featureAbility.acquireDataAbilityHelper( "dataability:///com.example.DataAbility" ); @@ -723,7 +731,7 @@ const va = { "name": "roe1", "age": 21, "salary": 20.5, - "blobType": u8, + "blobType": "u8", } let da = new ohos_data_ability.DataAbilityPredicates() DAHelper.update( @@ -769,7 +777,7 @@ const va = { "name": "roe1", "age": 21, "salary": 20.5, - "blobType": u8, + "blobType": "u8", } let da = new ohos_data_ability.DataAbilityPredicates() DAHelper.update( diff --git a/en/application-dev/reference/apis/js-apis-formextension.md b/en/application-dev/reference/apis/js-apis-formextension.md index dea964de0b..0329e0cf35 100644 --- a/en/application-dev/reference/apis/js-apis-formextension.md +++ b/en/application-dev/reference/apis/js-apis-formextension.md @@ -1,6 +1,6 @@ # FormExtension -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides **FormExtension** APIs. @@ -46,6 +46,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been **Example** ```js + import formBindingData from '@ohos.application.formBindingData' export default class MyFormExtension extends FormExtension { onCreate(want) { 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 **Example** ```js + import formBindingData from '@ohos.application.formBindingData' export default class MyFormExtension extends FormExtension { onUpdate(formId) { console.log('FormExtension onUpdate, formId:' + formId); @@ -130,6 +132,7 @@ Called to notify the widget provider of the change of visibility. **Example** ```js + import formBindingData from '@ohos.application.formBindingData' export default class MyFormExtension extends FormExtension { onVisibilityChange(newStatus) { console.log('FormExtension onVisibilityChange, newStatus:' + newStatus); @@ -213,9 +216,35 @@ Called when the configuration of the environment where the ability is running is **Example** ```js - class MyFormExtension extends MyFormExtension { + class MyFormExtension extends FormExtension { onConfigurationUpdated(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; + } + } + ``` diff --git a/en/application-dev/reference/apis/js-apis-formhost.md b/en/application-dev/reference/apis/js-apis-formhost.md index bd087eda81..5c012bf525 100644 --- a/en/application-dev/reference/apis/js-apis-formhost.md +++ b/en/application-dev/reference/apis/js-apis-formhost.md @@ -1,6 +1,6 @@ # FormHost -> **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to the widget host. @@ -57,15 +57,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Parameters** @@ -147,16 +147,16 @@ SystemCapability.Ability.Form **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ----------- | -| formId | string | Yes | ID of a widget. | -| isReleaseCache | boolean | No | Whether to release the cache.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ----------- | + | formId | string | Yes | ID of a widget. | + | isReleaseCache | boolean | No | Whether to release the cache.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -209,15 +209,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -270,15 +270,15 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formId | string | Yes | ID of a widget.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formId | string | Yes | ID of a widget.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -311,7 +311,7 @@ SystemCapability.Ability.Form **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.notifyVisibleForms(formId, (error, data) => { if (error.code) { console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); @@ -337,14 +337,14 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.notifyVisibleForms(formId).then(() => { console.log('formHost notifyVisibleForms success'); }).catch((error) => { @@ -372,7 +372,7 @@ SystemCapability.Ability.Form **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.notifyInvisibleForms(formId, (error, data) => { if (error.code) { console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); @@ -398,14 +398,14 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.notifyInvisibleForms(formId).then(() => { console.log('formHost notifyInvisibleForms success'); }).catch((error) => { @@ -433,7 +433,7 @@ SystemCapability.Ability.Form **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.enableFormsUpdate(formId, (error, data) => { if (error.code) { console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); @@ -459,14 +459,14 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.enableFormsUpdate(formId).then(() => { console.log('formHost enableFormsUpdate success'); }).catch((error) => { @@ -494,7 +494,7 @@ SystemCapability.Ability.Form **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.disableFormsUpdate(formId, (error, data) => { if (error.code) { console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); @@ -520,14 +520,14 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** ```js - var formId = "12400633174999288"; + var formId = ["12400633174999288"]; formHost.disableFormsUpdate(formId).then(() => { console.log('formHost disableFormsUpdate success'); }).catch((error) => { @@ -574,9 +574,9 @@ SystemCapability.Ability.Form **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -591,7 +591,7 @@ SystemCapability.Ability.Form ## getAllFormsInfo -getAllFormsInfo(callback: AsyncCallback<Array<FormInfo>>): void; +getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 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 **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -619,7 +619,8 @@ SystemCapability.Ability.Form ## getAllFormsInfo -getAllFormsInfo(): Promise<Array<FormInfo>>; +getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>; + 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 ## getFormsInfo -getFormsInfo(bundleName: string, callback: AsyncCallback<Array<FormInfo>>): void; +getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; + 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 **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -674,7 +676,8 @@ SystemCapability.Ability.Form ## getFormsInfo -getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback<Array<FormInfo>>): void; +getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; + 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 **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| moduleName | string | Yes| Module name.| -| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | moduleName | string | Yes| Module name.| + | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -704,7 +707,8 @@ SystemCapability.Ability.Form ## getFormsInfo -getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<FormInfo>>; +getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>; + 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 **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| bundleName | string | Yes| Bundle name of the target application.| -| moduleName | string | No| Module name.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | bundleName | string | Yes| Bundle name of the target application.| + | moduleName | string | No| Module name.| **Return value** @@ -767,7 +771,7 @@ SystemCapability.Ability.Form ## deleteInvalidForms -function deleteInvalidForms(formIds: Array<string>): Promise<number>; +deleteInvalidForms(formIds: Array<string>): Promise<number>; Deletes invalid widgets from the list. This API uses a promise to return the result. @@ -800,7 +804,7 @@ SystemCapability.Ability.Form ## acquireFormState -acquireFormState(want: Want, callback: AsyncCallback<FormStateInfo>): void; +acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo>): void; Obtains the widget state. This API uses an asynchronous callback to return the result. @@ -819,9 +823,14 @@ SystemCapability.Ability.Form ```js var want = { - "deviceId": "", - "bundleName": "com.extreme.test", - "abilityName": "com.extreme.test.MainAbility" + "deviceId": "", + "bundleName": "ohos.samples.FormApplication", + "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) => { if (error.code) { @@ -834,7 +843,7 @@ SystemCapability.Ability.Form ## acquireFormState -function acquireFormState(want: Want): Promise<FormStateInfo>; +acquireFormState(want: Want): Promise<formInfo.FormStateInfo>; Obtains the widget state. This API uses a promise to return the result. @@ -858,9 +867,14 @@ SystemCapability.Ability.Form ```js var want = { - "deviceId": "", - "bundleName": "com.extreme.test", - "abilityName": "com.extreme.test.MainAbility" + "deviceId": "", + "bundleName": "ohos.samples.FormApplication", + "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) => { console.log('formHost acquireFormState, data:' + JSON.stringify(data)); @@ -962,16 +976,16 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formIds | Array<string> | Yes | List of widget IDs.| -| isVisible | boolean | Yes | Whether to be visible.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formIds | Array<string> | Yes | List of widget IDs.| + | isVisible | boolean | Yes | Whether to be visible.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -1025,16 +1039,16 @@ SystemCapability.Ability.Form **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------- | -| formIds | Array<string> | Yes | List of widget IDs.| -| isEnableUpdate | boolean | Yes | Whether to enable update.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------- | + | formIds | Array<string> | Yes | List of widget IDs.| + | isEnableUpdate | boolean | Yes | Whether to enable update.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md index e48d4ada58..7ff3e5f3d8 100644 --- a/en/application-dev/reference/apis/js-apis-formprovider.md +++ b/en/application-dev/reference/apis/js-apis-formprovider.md @@ -80,7 +80,7 @@ SystemCapability.Ability.Form ## updateForm -updateForm(formId: string, formBindingData: FormBindingData, callback: AsyncCallback<void>): void; +updateForm(formId: string, formBindingData: formBindingData.FormBindingData,callback: AsyncCallback<void>): void; Updates a widget. This API uses an asynchronous callback to return the result. @@ -111,7 +111,7 @@ SystemCapability.Ability.Form ## updateForm -updateForm(formId: string, formBindingData: FormBindingData): Promise<void>; +updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise<void>; Updates a widget. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-processrunninginfo.md b/en/application-dev/reference/apis/js-apis-processrunninginfo.md index 29d055c83f..63f61d7472 100644 --- a/en/application-dev/reference/apis/js-apis-processrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-processrunninginfo.md @@ -1,11 +1,16 @@ # ProcessRunningInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides process running information. +## Modules to Import + +```js +import appManager from '@ohos.application.appManager' +``` ## Usage -- GitLab