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 136ec10fb630431a12d0455ca5e941249265267e..e892b7c4cded2faa02adcaa2945103a021741be9 100644 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ b/en/application-dev/reference/apis/js-apis-application-ability.md @@ -1,15 +1,12 @@ # Ability -> ![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. - Manages the ability lifecycle and context. - ## Modules to Import - ``` import Ability from '@ohos.application.Ability'; ``` @@ -23,6 +20,8 @@ import Ability from '@ohos.application.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.| | lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| +| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| + ## Ability.onCreate @@ -200,11 +199,12 @@ Called to save data during the ability migration preparation process. **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; } } ``` @@ -212,7 +212,7 @@ Called to save data during the ability migration preparation process. ## Ability.onNewWant -onNewWant(want: Want): void; +onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; Called when the ability startup mode is set to singleton. @@ -223,13 +223,17 @@ Called when the ability startup mode is set to singleton. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| + | launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.| **Example** ```js class myAbility extends Ability { - onNewWant(want) { + onNewWant(want, launchParams) { console.log('onNewWant, want:' + want.abilityName); + if (launchParams.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { + console.log('onNewWant, launchReason is continuation'); + } } } ``` @@ -259,6 +263,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 @@ -291,6 +321,9 @@ Sends sequenceable data to the target ability. ```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; @@ -361,6 +394,9 @@ Sends sequenceable data to the target ability and obtains the sequenceable data ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ + name:"" + str:"" + num: 1 constructor(name, str) { this.name = name; this.str = str; @@ -445,7 +481,7 @@ Releases the caller interface of the target ability. onRelease(callback: OnReleaseCallBack): void; -Registers a callback that is invoked when the Stub on the target ability is disconnected. +Registers a callback that is invoked when the stub on the target ability is disconnected. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -509,6 +545,9 @@ Registers a caller notification callback, which is invoked when the target abili ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ + name:"" + str:"" + num: 1 constructor(name, str) { this.name = name; this.str = str; diff --git a/en/application-dev/reference/apis/js-apis-formextension.md b/en/application-dev/reference/apis/js-apis-formextension.md index 0329e0cf3595887133d17c9af400df4b916d7845..87660f087b82eca3e1a3e16538be564d94ed8dd9 100644 --- a/en/application-dev/reference/apis/js-apis-formextension.md +++ b/en/application-dev/reference/apis/js-apis-formextension.md @@ -21,7 +21,7 @@ None | Name | Type | Readable| Writable| Description | | ------- | ------------------------------------------------------- | ---- | ---- | --------------------------------------------------- | -| context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This class is inherited from **ExtensionContext**.| +| context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This context is inherited from **ExtensionContext**.| ## onCreate @@ -227,7 +227,7 @@ Called when the configuration of the environment where the ability is running is 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. +Called when the widget provider receives the status query result of a specified service widget. By default, the initial state is returned. **System capability**: SystemCapability.Ability.Form diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index f54e0769783406311f1127adc6891d7d997c5b51..dac99ebed30a69168c24d3c168aa27dd98eab0c9 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -914,7 +914,7 @@ WantAgent.equal(wantAgent1, wantAgent2).then((data) => { }); ``` -## WantAgent.getOperationType +## WantAgent.getOperationType9+ getOperationType(agent: WantAgent, callback: AsyncCallback\): void; @@ -975,7 +975,7 @@ WantAgent.getOperationType(wantAgent, (OperationType) => { }) ``` -## WantAgent.getOperationType +## WantAgent.getOperationType9+ getOperationType(agent: WantAgent): Promise\;