> 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';
@@ -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
importAbilityfrom'@ohos.application.Ability';
classMyMessageAble{// 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
importAbilityfrom'@ohos.application.Ability';
classMyMessageAble{
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
importAbilityfrom'@ohos.application.Ability';
classMyMessageAble{
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.
> 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 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 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
| 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.|
> 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.|
> 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.