You need to sign in or sign up before continuing.
未验证 提交 077f48ab 编写于 作者: O openharmony_ci 提交者: Gitee

!8387 翻译完成:7967 ServiceExtensionAbility开发指导错误示例代码修改

Merge pull request !8387 from wusongqing/TR7967
...@@ -39,10 +39,12 @@ OpenHarmony does not support creation of a Service Extension ability for third-p ...@@ -39,10 +39,12 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
``` ```
2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined and override the lifecycle callbacks of the base class. The code sample is as follows: 2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined (**entry\src\main\ets\ServiceExtAbility\ServiceExtAbility.ts** by default) and override the lifecycle callbacks of the base class. The code sample is as follows:
```js ```js
import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from '@ohos.rpc' import rpc from '@ohos.rpc'
class StubTest extends rpc.RemoteObject { class StubTest extends rpc.RemoteObject {
constructor(des) { constructor(des) {
super(des); super(des);
...@@ -51,7 +53,8 @@ OpenHarmony does not support creation of a Service Extension ability for third-p ...@@ -51,7 +53,8 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
} }
} }
class ServiceExt extends ServiceExtensionAbility { class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log('onCreate, want:' + want.abilityName); console.log('onCreate, want:' + want.abilityName);
} }
onRequest(want, startId) { onRequest(want, startId) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册