Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7be99485
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
7be99485
编写于
9月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!9582 [翻译完成】#I5NCZN
Merge pull request !9582 from Annie_wang/PR8351
上级
84270cc5
86bfc868
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
52 deletion
+73
-52
en/application-dev/reference/apis/js-apis-distributed-data.md
...pplication-dev/reference/apis/js-apis-distributed-data.md
+73
-52
未找到文件。
en/application-dev/reference/apis/js-apis-distributed-data.md
浏览文件 @
7be99485
...
@@ -512,8 +512,8 @@ Subscribes to service status changes.
...
@@ -512,8 +512,8 @@ Subscribes to service status changes.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event | string | Yes | Event to subscribe to. The value is
**distributedDataServiceDie**
, which indicates
service status changes
.|
| event | string | Yes | Event to subscribe to. The value is
**distributedDataServiceDie**
, which indicates
a service status change event
.|
| deathCallback | Callback
<
void
>
| Yes | Callback
invoked to return service status changes
.|
| deathCallback | Callback
<
void
>
| Yes | Callback
used to return a service status change event
.|
**Example**
**Example**
...
@@ -536,7 +536,7 @@ try {
...
@@ -536,7 +536,7 @@ try {
off(event: 'distributedDataServiceDie', deathCallback?: Callback
<
void
>
): void
off(event: 'distributedDataServiceDie', deathCallback?: Callback
<
void
>
): void
Unsubscribes from
the
service status changes.
Unsubscribes from service status changes.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
**System capability**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
...
@@ -544,8 +544,8 @@ Unsubscribes from the service status changes.
...
@@ -544,8 +544,8 @@ Unsubscribes from the service status changes.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event | string | Yes | Event to unsubscribe from. The value is
**distributedDataServiceDie**
, which indicates
service status changes
.|
| event | string | Yes | Event to unsubscribe from. The value is
**distributedDataServiceDie**
, which indicates
a service status change event
.|
| deathCallback | Callback
<
void
>
| No | Callback
used to return service status changes
.|
| deathCallback | Callback
<
void
>
| No | Callback
for the service status change event
.|
**Example**
**Example**
...
@@ -744,7 +744,7 @@ try {
...
@@ -744,7 +744,7 @@ try {
console
.
log
(
'
getResultSet succeed.
'
);
console
.
log
(
'
getResultSet succeed.
'
);
resultSet
=
result
;
resultSet
=
result
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getResultSet failed:
'
+
err
);
console
.
log
(
'
getResultSet failed:
'
+
err
);
});
});
const
count
=
resultSet
.
getCount
();
const
count
=
resultSet
.
getCount
();
console
.
log
(
"
getCount succeed:
"
+
count
);
console
.
log
(
"
getCount succeed:
"
+
count
);
...
@@ -777,7 +777,7 @@ try {
...
@@ -777,7 +777,7 @@ try {
console
.
log
(
'
getResultSet succeeded.
'
);
console
.
log
(
'
getResultSet succeeded.
'
);
resultSet
=
result
;
resultSet
=
result
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
getResultSet failed:
'
+
err
);
console
.
log
(
'
getResultSet failed:
'
+
err
);
});
});
const
position
=
resultSet
.
getPosition
();
const
position
=
resultSet
.
getPosition
();
console
.
log
(
"
getPosition succeed:
"
+
position
);
console
.
log
(
"
getPosition succeed:
"
+
position
);
...
@@ -2232,7 +2232,7 @@ try {
...
@@ -2232,7 +2232,7 @@ try {
on(event: 'dataChange', type: SubscribeType, observer: Callback
<
ChangeNotification
>
): void
on(event: 'dataChange', type: SubscribeType, observer: Callback
<
ChangeNotification
>
): void
Subscribes to data change
notification
s of the specified type.
Subscribes to data changes of the specified type.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -2240,9 +2240,9 @@ Subscribes to data change notifications of the specified type.
...
@@ -2240,9 +2240,9 @@ Subscribes to data change notifications of the specified type.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to subscribe to. The value is
**dataChange**
, which indicates
data changes
. |
| event |string | Yes |Event to subscribe to. The value is
**dataChange**
, which indicates
a data change event
. |
| type |
[
SubscribeType
](
#subscribetype
)
| Yes |Type of data change
s
. |
| type |
[
SubscribeType
](
#subscribetype
)
| Yes |Type of data change. |
| observer |Callback
<
[ChangeNotification](#changenotification)
>
| Yes |Callback used to return
the data changes
.|
| observer |Callback
<
[ChangeNotification](#changenotification)
>
| Yes |Callback used to return
a data change event
.|
**Example**
**Example**
...
@@ -2258,7 +2258,7 @@ kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_LOCAL, fun
...
@@ -2258,7 +2258,7 @@ kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_LOCAL, fun
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
Subscribes to
data
synchronization complete events.
Subscribes to synchronization complete events.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -2266,8 +2266,8 @@ Subscribes to data synchronization complete events.
...
@@ -2266,8 +2266,8 @@ Subscribes to data synchronization complete events.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates
completion of a data synchronization
. |
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates
a synchronization complete event
. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| Yes |Callback used to return
the data synchronization resul
t. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| Yes |Callback used to return
a synchronization complete even
t. |
**Example**
**Example**
...
@@ -2282,7 +2282,7 @@ kvStore.on('syncComplete', function (data) {
...
@@ -2282,7 +2282,7 @@ kvStore.on('syncComplete', function (data) {
off(event:'dataChange', observer?: Callback
<
ChangeNotification
>
): void
off(event:'dataChange', observer?: Callback
<
ChangeNotification
>
): void
Unsubscribes from data change
notification
s.
Unsubscribes from data changes.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -2290,19 +2290,28 @@ Unsubscribes from data change notifications.
...
@@ -2290,19 +2290,28 @@ Unsubscribes from data change notifications.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to unsubscribe from. The value is
**dataChange**
, which indicates
data changes
. |
| event |string | Yes |Event to unsubscribe from. The value is
**dataChange**
, which indicates
a data change event
. |
| observer |Callback
<
[ChangeNotification](#changenotification)
>
|No |Callback
used to return the data changes
.|
| observer |Callback
<
[ChangeNotification](#changenotification)
>
|No |Callback
for the service status change event
.|
**Example**
**Example**
```
js
```
js
let
kvStore
;
let
kvStore
;
kvStore
.
on
(
'
dataChange
'
,
function
(
data
)
{
class
KvstoreModel
{
console
.
log
(
"
callback call data:
"
+
data
);
call
(
data
)
{
});
console
.
log
(
"
dataChange:
"
+
data
);
kvStore
.
off
(
'
dataChange
'
,
function
(
data
)
{
}
console
.
log
(
"
callback call data:
"
+
data
);
subscribeDataChange
()
{
});
if
(
kvStore
!=
null
)
{
kvStore
.
on
(
'
dataChange
'
,
distributedData
.
SubscribeType
.
SUBSCRIBE_TYPE_REMOTE
,
this
.
call
);
}
}
unsubscribeDataChange
()
{
if
(
kvStore
!=
null
)
{
kvStore
.
off
(
'
dataChange
'
,
this
.
call
);
}
}
}
```
```
...
@@ -3708,7 +3717,7 @@ try {
...
@@ -3708,7 +3717,7 @@ try {
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
Subscribes to
the data
synchronization complete events.
Subscribes to synchronization complete events.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -3716,8 +3725,8 @@ Subscribes to the data synchronization complete events.
...
@@ -3716,8 +3725,8 @@ Subscribes to the data synchronization complete events.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates
completion of a data synchronization
. |
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates
a synchronization complete event
. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| Yes |Callback invoked to return
the synchronization resul
t. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| Yes |Callback invoked to return
a synchronization complete even
t. |
**Example**
**Example**
...
@@ -3744,7 +3753,7 @@ try {
...
@@ -3744,7 +3753,7 @@ try {
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
Unsubscribes from
the data
synchronization complete events.
Unsubscribes from synchronization complete events.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -3752,21 +3761,27 @@ Unsubscribes from the data synchronization complete events.
...
@@ -3752,21 +3761,27 @@ Unsubscribes from the data synchronization complete events.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to unsubscribe from. The value is
**syncComplete**
, which indicates
completion of a data synchronization
. |
| event |string | Yes |Event to unsubscribe from. The value is
**syncComplete**
, which indicates
a synchronization complete event
. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| No |Callback
used to return the synchronization resul
t. |
| syncCallback |Callback
<
Array
<
[string, number]
>>
| No |Callback
for the synchronization complete even
t. |
**Example**
**Example**
```
js
```
js
let
kvStore
;
let
kvStore
;
try
{
class
KvstoreModel
{
const
func
=
function
(
data
)
{
call
(
data
)
{
console
.
log
(
'
syncComplete
'
+
data
)
console
.
log
(
"
syncComplete:
"
+
data
);
};
}
kvStore
.
on
(
'
syncComplete
'
,
func
);
subscribeSyncComplete
()
{
kvStore
.
off
(
'
syncComplete
'
,
func
);
if
(
kvStore
!=
null
)
{
}
catch
(
e
)
{
kvStore
.
on
(
'
syncComplete
'
,
this
.
call
);
console
.
log
(
'
syncComplete e
'
+
e
);
}
}
unsubscribeSyncComplete
()
{
if
(
kvStore
!=
null
)
{
kvStore
.
off
(
'
syncComplete
'
,
this
.
call
);
}
}
}
}
```
```
...
@@ -3785,7 +3800,7 @@ Synchronizes the KV store manually. For details about the synchronization modes
...
@@ -3785,7 +3800,7 @@ Synchronizes the KV store manually. For details about the synchronization modes
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| deviceIdList |string[] | Yes |IDs of the devices
to be synchronized. These devices must be in the same networking environment.
|
| deviceIdList |string[] | Yes |IDs of the devices
in the same networking environment to be synchronized.
|
| mode |
[
SyncMode
](
#syncmode
)
| Yes |Synchronization mode. |
| mode |
[
SyncMode
](
#syncmode
)
| Yes |Synchronization mode. |
| allowedDelayMs |number | No |Allowed synchronization delay time, in ms. |
| allowedDelayMs |number | No |Allowed synchronization delay time, in ms. |
...
@@ -5067,7 +5082,7 @@ try {
...
@@ -5067,7 +5082,7 @@ try {
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
Subscribes to
the data
synchronization complete events.
Subscribes to synchronization complete events.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -5075,8 +5090,8 @@ Subscribes to the data synchronization complete events.
...
@@ -5075,8 +5090,8 @@ Subscribes to the data synchronization complete events.
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates
the dat
a synchronization complete event.|
| event |string | Yes |Event to subscribe to. The value is
**syncComplete**
, which indicates a synchronization complete event.|
| syncCallback |Callback
<Array
&
lt
;[
string
,
number
]&
gt
;
>
| Yes |Callback
used to return the synchronization resul
t. |
| syncCallback |Callback
<Array
&
lt
;[
string
,
number
]&
gt
;
>
| Yes |Callback
invoked to return a synchronization complete even
t. |
**Example**
**Example**
...
@@ -5103,7 +5118,7 @@ try {
...
@@ -5103,7 +5118,7 @@ try {
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
Unsubscribes from
the synchronization complete events. This API uses a synchronous callback to return the result
.
Unsubscribes from
synchronization complete events. This API returns the result synchronously
.
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
**System capability**
: SystemCapability.DistributedDataManager.KVStore.Core
...
@@ -5111,21 +5126,27 @@ Unsubscribes from the synchronization complete events. This API uses a synchrono
...
@@ -5111,21 +5126,27 @@ Unsubscribes from the synchronization complete events. This API uses a synchrono
| Name | Type| Mandatory | Description |
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| ----- | ------ | ---- | ----------------------- |
| event |string | Yes |Event to unsubscribe from. The value is
**syncComplete**
, which indicates
the dat
a synchronization complete event.|
| event |string | Yes |Event to unsubscribe from. The value is
**syncComplete**
, which indicates a synchronization complete event.|
| syncCallback |Callback<Array
<
[string, number]
>>
| No |Callback
used to return the synchronization resul
t. |
| syncCallback |Callback<Array
<
[string, number]
>>
| No |Callback
for the synchronization complete even
t. |
**Example**
**Example**
```
js
```
js
let
kvStore
;
let
kvStore
;
try
{
class
KvstoreModel
{
const
func
=
function
(
data
)
{
call
(
data
)
{
console
.
log
(
'
syncComplete
'
+
data
)
console
.
log
(
"
syncComplete:
"
+
data
);
};
}
kvStore
.
on
(
'
syncComplete
'
,
func
);
subscribeSyncComplete
()
{
kvStore
.
off
(
'
syncComplete
'
,
func
);
if
(
kvStore
!=
null
)
{
}
catch
(
e
)
{
kvStore
.
on
(
'
syncComplete
'
,
this
.
call
);
console
.
log
(
'
syncComplete e
'
+
e
);
}
}
unsubscribeSyncComplete
()
{
if
(
kvStore
!=
null
)
{
kvStore
.
off
(
'
syncComplete
'
,
this
.
call
);
}
}
}
}
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录