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 bca94a28134524a76e3e2f77f9b832ab620a86af..490bb6eb14a89e1345d3ef7a77370891254110e5 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 0000000000000000000000000000000000000000..8371830fe05b7b9ab89973f5a9390160734547ef --- /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 10d36843925949c185a431ddb60dd33c1493d7b8..1ce0a05d1ef3c97b9c0dd6d53c6abf22c2ec670c 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 dea964de0b45fdeca88defea6cb06cd70d8eb43a..0329e0cf3595887133d17c9af400df4b916d7845 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 bd087eda8196a134a5ecbfbbecaaf47a6af9bfa1..5c012bf525f59b08454fd7aa0886a5a0ed419d0e 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 e48d4ada58ae469c73c71b6f90ae682610544706..7ff3e5f3d80fcfb93b057bf5e67def7d1f197e92 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 29d055c83fc1e408404a3d91c81ea0ab090a6258..63f61d7472be78055c0c4612aa154b2f9eb4c922 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