Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
652a4b72
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
652a4b72
编写于
7月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!7258 modify continuation manager code example
Merge pull request !7258 from zhangmingxiang/0728
上级
4a656cd4
0227998d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
0 deletion
+12
-0
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md
...eference/apis/js-apis-continuation-continuationManager.md
+12
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md
浏览文件 @
652a4b72
...
@@ -97,6 +97,7 @@ register(options?: ContinuationExtraParams): Promise\<number>;
...
@@ -97,6 +97,7 @@ register(options?: ContinuationExtraParams): Promise\<number>;
**示例:**
**示例:**
```
js
```
js
let
token
=
-
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
};
};
...
@@ -157,6 +158,7 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
...
@@ -157,6 +158,7 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
data
)
=>
{
console
.
info
(
'
onDeviceConnect len:
'
+
data
.
length
);
console
.
info
(
'
onDeviceConnect len:
'
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
@@ -186,6 +188,7 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
...
@@ -186,6 +188,7 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
data
)
=>
{
console
.
info
(
'
onDeviceDisconnect len:
'
+
data
.
length
);
console
.
info
(
'
onDeviceDisconnect len:
'
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
@@ -213,6 +216,7 @@ off(type: "deviceConnect", token: number): void;
...
@@ -213,6 +216,7 @@ off(type: "deviceConnect", token: number): void;
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
off
(
"
deviceConnect
"
,
token
);
continuationManager
.
off
(
"
deviceConnect
"
,
token
);
```
```
...
@@ -234,6 +238,7 @@ off(type: "deviceDisconnect", token: number): void;
...
@@ -234,6 +238,7 @@ off(type: "deviceDisconnect", token: number): void;
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
off
(
"
deviceDisconnect
"
,
token
);
continuationManager
.
off
(
"
deviceDisconnect
"
,
token
);
```
```
...
@@ -255,6 +260,7 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
...
@@ -255,6 +260,7 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
startDeviceManager
(
token
,
(
err
,
data
)
=>
{
continuationManager
.
startDeviceManager
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
startDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
startDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
...
@@ -283,6 +289,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
...
@@ -283,6 +289,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
};
};
...
@@ -319,6 +326,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
...
@@ -319,6 +326,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
};
};
...
@@ -351,6 +359,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
...
@@ -351,6 +359,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
let
deviceId
:
string
=
"
test deviceId
"
;
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
,
(
err
,
data
)
=>
{
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
...
@@ -386,6 +395,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
...
@@ -386,6 +395,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
let
deviceId
:
string
=
"
test deviceId
"
;
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
)
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -414,6 +424,7 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
...
@@ -414,6 +424,7 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
unregister
(
token
,
(
err
,
data
)
=>
{
continuationManager
.
unregister
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
unregister failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
unregister failed, cause:
'
+
JSON
.
stringify
(
err
));
...
@@ -446,6 +457,7 @@ unregister(token: number): Promise\<void>;
...
@@ -446,6 +457,7 @@ unregister(token: number): Promise\<void>;
**示例:**
**示例:**
```
js
```
js
let
token
=
1
;
continuationManager
.
unregister
(
token
)
continuationManager
.
unregister
(
token
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
'
unregister finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
unregister finished,
'
+
JSON
.
stringify
(
data
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录