Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e37715ed
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e37715ed
编写于
9月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23747 guidance ArkTs sample code adaption
Merge pull request !23747 from dufresne_andy/master
上级
fad3291e
11ecf2f4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
11 deletion
+11
-11
zh-cn/application-dev/reference/apis/js-apis-app-ability-driverExtensionAbility.md
...erence/apis/js-apis-app-ability-driverExtensionAbility.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-inner-application-driverExtensionContext.md
.../apis/js-apis-inner-application-driverExtensionContext.md
+1
-1
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-app-ability-driverExtensionAbility.md
浏览文件 @
e37715ed
...
@@ -45,7 +45,7 @@ Extension生命周期回调,在创建时回调,执行初始化业务逻辑
...
@@ -45,7 +45,7 @@ Extension生命周期回调,在创建时回调,执行初始化业务逻辑
```
ts
```
ts
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
onInit
(
want
)
{
onInit
(
want
:
Want
)
{
console
.
log
(
'
onInit, want: ${want.abilityName}
'
);
console
.
log
(
'
onInit, want: ${want.abilityName}
'
);
}
}
}
}
...
@@ -96,14 +96,14 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
...
@@ -96,14 +96,14 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
```
ts
```
ts
import
rpc
from
'
@ohos.rpc
'
;
import
rpc
from
'
@ohos.rpc
'
;
class
StubTest
extends
rpc
.
RemoteObject
{
class
StubTest
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
constructor
(
des
:
string
)
{
super
(
des
);
super
(
des
);
}
}
onRemoteMessageRequest
(
code
,
data
,
reply
,
o
ption
)
{
onRemoteMessageRequest
(
code
:
number
,
data
:
MessageSequence
,
reply
:
MessageSequence
,
option
:
MessageO
ption
)
{
}
}
}
}
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
onConnect
(
want
)
{
onConnect
(
want
:
Want
)
{
console
.
log
(
'
onConnect , want: ${want.abilityName}
'
);
console
.
log
(
'
onConnect , want: ${want.abilityName}
'
);
return
new
StubTest
(
'
test
'
);
return
new
StubTest
(
'
test
'
);
}
}
...
@@ -115,10 +115,10 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
...
@@ -115,10 +115,10 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC
```
ts
```
ts
import
rpc
from
'
@ohos.rpc
'
;
import
rpc
from
'
@ohos.rpc
'
;
class
StubTest
extends
rpc
.
RemoteObject
{
class
StubTest
extends
rpc
.
RemoteObject
{
constructor
(
des
)
{
constructor
(
des
:
string
)
{
super
(
des
);
super
(
des
);
}
}
onRemoteMessageRequest
(
code
,
data
,
reply
,
o
ption
)
{
onRemoteMessageRequest
(
code
:
number
,
data
:
MessageSequence
,
reply
:
MessageSequence
,
option
:
MessageO
ption
)
{
}
}
}
}
async
function
getDescriptor
()
{
async
function
getDescriptor
()
{
...
@@ -126,7 +126,7 @@ async function getDescriptor() {
...
@@ -126,7 +126,7 @@ async function getDescriptor() {
return
"
asyncTest
"
return
"
asyncTest
"
}
}
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
async
onConnect
(
want
)
{
async
onConnect
(
want
:
Want
)
{
console
.
log
(
`onConnect , want:
${
want
.
abilityName
}
`
);
console
.
log
(
`onConnect , want:
${
want
.
abilityName
}
`
);
let
descriptor
=
await
getDescriptor
();
let
descriptor
=
await
getDescriptor
();
return
new
StubTest
(
descriptor
);
return
new
StubTest
(
descriptor
);
...
@@ -152,7 +152,7 @@ Extension的生命周期回调,客户端执行断开连接服务时回调。
...
@@ -152,7 +152,7 @@ Extension的生命周期回调,客户端执行断开连接服务时回调。
```
ts
```
ts
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
onDisconnect
(
want
)
{
onDisconnect
(
want
:
Want
)
{
console
.
log
(
'
onDisconnect, want: ${want.abilityName}
'
);
console
.
log
(
'
onDisconnect, want: ${want.abilityName}
'
);
}
}
}
}
...
@@ -162,7 +162,7 @@ Extension的生命周期回调,客户端执行断开连接服务时回调。
...
@@ -162,7 +162,7 @@ Extension的生命周期回调,客户端执行断开连接服务时回调。
```
ts
```
ts
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
async
onDisconnect
(
want
)
{
async
onDisconnect
(
want
:
Want
)
{
console
.
log
(
'
onDisconnect, want: ${want.abilityName}
'
);
console
.
log
(
'
onDisconnect, want: ${want.abilityName}
'
);
// 调用异步函数...
// 调用异步函数...
}
}
...
@@ -188,7 +188,7 @@ onDump(params: Array\<string>): Array\<string>;
...
@@ -188,7 +188,7 @@ onDump(params: Array\<string>): Array\<string>;
```
ts
```
ts
class
DriverExt
extends
DriverExtension
{
class
DriverExt
extends
DriverExtension
{
onDump
(
params
)
{
onDump
(
params
:
Array
<
string
>
)
{
console
.
log
(
'
dump, params: ${JSON.stringify(params)}
'
);
console
.
log
(
'
dump, params: ${JSON.stringify(params)}
'
);
return
[
'
params
'
];
return
[
'
params
'
];
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-driverExtensionContext.md
浏览文件 @
e37715ed
...
@@ -22,7 +22,7 @@ import common from '@ohos.app.ability.common';
...
@@ -22,7 +22,7 @@ import common from '@ohos.app.ability.common';
```
ts
```
ts
import
DriverExtensionAbility
from
'
@ohos.app.ability.DriverExtensionAbility
'
;
import
DriverExtensionAbility
from
'
@ohos.app.ability.DriverExtensionAbility
'
;
let
context
;
let
context
:
DriverExtensionContext
;
class
EntryAbility
extends
DriverExtensionAbility
{
class
EntryAbility
extends
DriverExtensionAbility
{
onInit
()
{
onInit
()
{
context
=
this
.
context
;
// 获取DriverExtensionContext
context
=
this
.
context
;
// 获取DriverExtensionContext
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录