diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index a06bca19748db57c57a53367fb16af9b086a4b2d..0fafc6f7b97312e45f594d711ea4151135308cc9 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -1,42 +1,33 @@ # AbilityContext -- [属性](#属性) -- [startAbility](#startAbility) -- [startAbility](#startAbility) -- [startAbilityForResult](#startAbilityForResult) -- [startAbilityForResult](#startAbilityForResult) -- [terminateSelf](#terminateSelf) -- [terminateSelf](#terminateSelf) -- [terminateSelfWithResult](#terminateSelfWithResult) -- [terminateSelfWithResult](#terminateSelfWithResult) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -Ability的上下文环境,继承自Context。 +Implements ability context. This module is inherited from **Context**. -## 属性 +## Attributes -| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| abilityInfo | AbilityInfo | 是 | 否 | Abilityinfo相关信息 | -| currentHapModuleInfo | HapModuleInfo | 是 | 否 | 当前hap包的信息 | +| abilityInfo | AbilityInfo | Yes| No| Ability information.| +| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| ## startAbility startAbility(want: Want, callback: AsyncCallback<void>): void -启动Ability。 +Starts an ability. This method uses a callback to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 | - | callback | AsyncCallback<void> | 是 | callback形式返回启动结果 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| -- 示例: +- Example ``` var want = { "deviceId": "", @@ -53,19 +44,19 @@ startAbility(want: Want, callback: AsyncCallback<void>): void startAbility(want: Want): Promise<void>; -启动Ability。通过Promise返回结果。 +Starts an ability. This method uses a promise to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | Promise形式返回启动结果。 | + | Promise<void> | Promise used to return the result.| -- 示例: +- Example ``` var want = { "deviceId": "", @@ -85,16 +76,16 @@ startAbility(want: Want): Promise<void>; startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -启动Ability并在结束的时候返回执行结果。 +Starts an ability. This method uses a callback to return the execution result when the ability is terminated. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want |[Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 | - | callback | Callback<[AbilityResult](js-apis-featureAbility.md#AbilityResult类型说明)> | 是 | 执行结果回调函数。 | + | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | callback | Callback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| -- 示例: +- Example ``` this.context.startAbilityForResult( {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, @@ -110,19 +101,19 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): startAbilityForResult(want: Want): Promise<AbilityResult>; -启动Ability并在结束的时候返回执行结果。 +Starts an ability. This method uses a promise to return the execution result when the ability is terminated. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 启动Ability的want信息。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| -- 返回值 - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<[AbilityResult](js-apis-featureAbility.md#AbilityResult类型说明)> | Promise形式返回执行结果。 | + | Promise<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Promise used to return the result.| -- 示例: +- Example ``` this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => { console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode) @@ -136,14 +127,14 @@ startAbilityForResult(want: Want): Promise<AbilityResult>; terminateSelf(callback: AsyncCallback<void>): void; -停止Ability自身。 +Terminates this ability. This method uses a callback to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | 否 | 回调函数,返回接口调用是否成功的结果。 | + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` this.context.terminateSelf((err) => { console.log('terminateSelf result:' + JSON.stringfy(err); @@ -155,14 +146,14 @@ terminateSelf(callback: AsyncCallback<void>): void; terminateSelf(): Promise<void>; -停止Ability自身。通过Promise返回结果。 +Terminates this ability. This method uses a promise to return the result. -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | 返回一个Promise,包含接口的结果。 | + | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` this.context.terminateSelf(want).then((data) => { console.log('success:' + JSON.stringfy(data)); @@ -176,15 +167,15 @@ terminateSelf(): Promise<void>; terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; -停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息。 +Terminates this ability. This method uses a callback to return the information to the caller of **startAbilityForResult**. -- 参数 - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | parameter | [AbilityResult](js-apis-featureAbility.md#AbilityResult类型说明) | 是 | 返回给调用startAbilityForResult 接口调用方的相关信息。 | - | callback | Callback<void> | 否 | callback形式返回停止结果 | + | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| + | callback | Callback<void> | No| Callback used to return the information.| -- 示例: +- Example ``` this.context.terminateSelfWithResult( { @@ -201,19 +192,19 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi terminateSelfWithResult(parameter: AbilityResult): Promise<void>; -停止Ability,并返回给调用startAbilityForResult 接口相关信息。 +Terminates this ability. This method uses a promise to return information to the caller of **startAbilityForResult**. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | parameter | [AbilityResult](js-apis-featureAbility.md#AbilityResult类型说明) | 是 | 返回给startAbilityForResult 调用方的信息。 | + | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | promise形式返回停止结果 | + | Promise<void> | Promise used to return the result.| -- 示例: +- Example ``` this.context.terminateSelfWithResult( { diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md index bf211462e4c27807e47e0c997eac1971e382a5a9..ceb82e2732a54a107ca35e647c67d6ec16c6bf9d 100644 --- a/en/application-dev/reference/apis/js-apis-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-extension-context.md @@ -1,15 +1,14 @@ # ExtensionContext -- [属性](#属性) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -Extension的上下文环境,继承自Context。 +Implements extension context. This module is inherited from **Context**. -## 属性 +## Attributes -| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | 是 | 否 | 当前Hap包的信息。 | +| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| diff --git a/en/application-dev/reference/apis/js-apis-service-extension-context.md b/en/application-dev/reference/apis/js-apis-service-extension-context.md index ba9210e927487fe56c9ab94c011e681cf78b394b..fa46ef6df13d0e7bd7b4c8dd788fbe4184417488 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-context.md @@ -1,18 +1,10 @@ # ServiceExtensionContext -- [startAbility](#startAbility) -- [startAbility](#startAbility) -- [terminateSelf](#terminateSelf) -- [terminateSelf](#terminateSelf) -- [connectAbility](#connectAbility) -- [disconnectAbility](#disconnectAbility) -- [disconnectAbility](#disconnectAbility) -- [ConnectOptions](#ConnectOptions) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -ServiceExtension的上下文环境,提供ServiceExtension具有的能力和接口,继承自ExtensionContext。 +Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**. ## startAbility @@ -21,16 +13,16 @@ ServiceExtension的上下文环境,提供ServiceExtension具有的能力和接 startAbility(want: Want, callback: AsyncCallback<void>): void; -启动Ability。 +Starts an ability. This method uses a callback to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 | - | callback | AsyncCallback<void> | 否 | 回调函数,返回接口调用是否成功的结果。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` let want = { "bundleName": "com.example.myapp", @@ -46,19 +38,19 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; startAbility(want: Want): Promise<void>; -启动Ability。通过Promise返回结果。 +Starts an ability. This method uses a promise to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | 返回一个Promise,包含接口的结果。 | + | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` let want = { "bundleName": "com.example.myapp", @@ -76,14 +68,14 @@ startAbility(want: Want): Promise<void>; terminateSelf(callback: AsyncCallback<void>): void; -停止Ability自身。 +Terminates this ability. This method uses a callback to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | 否 | 回调函数,返回接口调用是否成功的结果。 | + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` this.context.terminateSelf((err) => { console.log('terminateSelf result:' + JSON.stringfy(err); @@ -95,14 +87,14 @@ terminateSelf(callback: AsyncCallback<void>): void; terminateSelf(): Promise<void>; -停止自身。通过Promise返回结果。 +Terminates this ability. This method uses a promise to return the result. -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | 返回一个Promise,包含接口的结果。 | + | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` this.context.terminateSelf(want).then((data) => { console.log('success:' + JSON.stringfy(data)); @@ -116,20 +108,20 @@ terminateSelf(): Promise<void>; connectAbility(want: Want, options: ConnectOptions): number; -将一个Ability与服务类型的Ability绑定。 +Connects this ability to a Service ability. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 | - | options | [ConnectOptions](#connectoptions) | 是 | ConnectOptions类型的回调函数,返回服务连接成功、断开或连接失败后的信息。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to connect to, such as the ability name and bundle name.| + | options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| -- 返回值 - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | number | 返回一个number,后续根据这个number去断开连接。 | + | number | A number, based on which the connection will be interrupted.| -- 示例: +- Example ``` let want = { "bundleName": "com.example.myapp", @@ -148,17 +140,17 @@ connectAbility(want: Want, options: ConnectOptions): number; disconnectAbility(connection: number, callback:AsyncCallback<void>): void; -将一个Ability与绑定的服务类型的Ability解绑。 +Disconnects this ability from the Service ability. This method uses a callback to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | connection | number | 是 | 在connectAbility中返回的number。 | - | callback | AsyncCallback<void> | 否 | 回调函数,返回接口调用是否成功的结果。 | + | connection | number | Yes| Number returned after **connectAbility** is called.| + | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` - this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值 + this.context.disconnectAbility(connection, (err) => { // connection is the return value of connectAbility. console.log('terminateSelf result:' + JSON.stringfy(err); } ``` @@ -168,21 +160,21 @@ disconnectAbility(connection: number, callback:AsyncCallback<void>): void; disconnectAbility(connection: number): Promise<void>; -将一个Ability与绑定的服务类型的Ability解绑。通过Promise返回结果。 +Disconnects this ability from the Service ability. This method uses a promise to return the result. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | connection | number | 是 | 在connectAbility中返回的number。 | + | connection | number | Yes| Number returned after **connectAbility** is called.| -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | Promise<void> | 返回一个Promise,包含接口的结果。 | + | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| -- 示例: +- Example ``` - this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值 + this.context.disconnectAbility(connection).then((data) => { // connection is the return value of connectAbility. console.log('success:' + JSON.stringfy(data)); )).catch((error) => { console.log('failed:' + JSON.stringfy(error)); @@ -192,10 +184,10 @@ disconnectAbility(connection: number): Promise<void>; ## ConnectOptions -ConnectOptions数据结构。 +Defines the **ConnectOptions** data structure. -| 名称 | 说明 | +| Name| Description| | -------- | -------- | -| onConnect(elementName:ElementName, remote:IRemoteObject) | Ability成功连接一个服务类型Ability的回调接口。 | -| onDisconnect(elementName:ElementName) | 对端服务发生异常或者被杀死回调该接口。 | -| onFailed(code: number) | 连接失败时回调该接口。 | +| onConnect(elementName:ElementName, remote:IRemoteObject) | Called when this ability is connected to a Service ability.| +| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.| +| onFailed(code: number) | Called when the connection fails.| diff --git a/en/application-dev/reference/apis/js-apis-service-extension.md b/en/application-dev/reference/apis/js-apis-service-extension.md index cde5ba29020f02c88b123fd3c5fa4541882e649a..22f46948c07041a90488fef30df310ddb2f1294f 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension.md +++ b/en/application-dev/reference/apis/js-apis-service-extension.md @@ -1,51 +1,43 @@ # ServiceExtension -- [导入模块](#导入模块) -- [权限](#权限) -- [属性](#属性) -- [onCreate](#onCreate) -- [onDestroy](#onDestroy) -- [onRequest](#onRequest) -- [onConnect](#onConnect) -- [onDisconnect](#onDisconnect) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -提供ServiceExtension服务扩展相关接口。 +Provides APIs related to **ServiceExtension**. -## 导入模块 +## Modules to Import ``` import ServiceExtension from '@ohos.application.ServiceExtension'; ``` -## 权限 +## Required Permissions -无 +None -## 属性 +## Attributes -| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | 是 | 否 | ServiceExtension的上下文环境,继承自ExtensionContext。 | +| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.| ## onCreate onCreate(want: Want): void; -Extension生命周期回调,在创建时回调,执行初始化业务逻辑操作。 +Called when an extension is created to initialize the service logic. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 当前Extension相关的Want类型信息,包括ability名称、bundle名称等。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| -- 示例: +- Example ``` onCreate(want) { console.log('onCreate, want:' + want.abilityName); @@ -57,9 +49,9 @@ Extension生命周期回调,在创建时回调,执行初始化业务逻辑 onDestroy(): void; -Extension生命周期回调,在销毁时回调,执行资源清理等操作。 +Called when this extension is destroyed to clear resources. -- 示例: +- Example ``` onDestroy() { console.log('onDestroy'); @@ -72,15 +64,15 @@ Extension生命周期回调,在销毁时回调,执行资源清理等操作 onRequest(want: Want, startId: number): void; -Extension生命周期回调,如果是startAbility拉起的服务,会在onCreate之后回调。每次拉起服务都会回调,startId会递增。 +Called after **onCreate** is invoked when an ability is started by calling **startAbility**. The value of **startId** is incremented for each ability that is started. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明) | 是 | 当前Extension相关的Want类型信息,包括ability名称、bundle名称等。 | - | startId | number | 是 | 返回拉起次数。首次拉起初始值返回1,多次之后自动递增。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| + | startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| -- 示例: +- Example ``` onRequest(want: Want, startId: number) { console.log('onRequest, want:' + want.abilityName); @@ -92,19 +84,19 @@ Extension生命周期回调,如果是startAbility拉起的服务,会在onCre onConnect(want: Want): rpc.RemoteObject; -Extension生命周期回调,如果是connectAbility拉起的服务,会在onCreate之后回调。返回一个RemoteObject对象,用于和客户端进行通信。 +Called after **onCreate** is invoked when an ability is started by calling **connectAbility**. A **RemoteObject** object is returned for communication with the client. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want类型说明)| 是 | 当前Extension相关的Want类型信息,包括ability名称、bundle名称等。 | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| -- 返回值: - | 类型 | 说明 | +- Return value + | Type| Description| | -------- | -------- | - | rpc.RemoteObject | 一个RemoteObject对象,用于和客户端进行通信。 | + | rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| -- 示例: +- Example ``` import rpc from '@ohos.rpc' class StubTest extends rpc.RemoteObject{ @@ -126,14 +118,14 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC onDisconnect(want: Want): void; -Extension的生命周期,断开服务连接时回调。 +Called when the ability is disconnected. -- 参数: - | 参数名 | 类型 | 必填 | 说明 | +- Parameters + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want |[Want](js-apis-featureAbility.md#Want类型说明)| 是 | 当前Extension相关的Want类型信息,包括ability名称、bundle名称等。 | + | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| -- 示例: +- Example ``` onDisconnect(want) { console.log('onDisconnect, want:' + want.abilityName);