未验证 提交 edfa5481 编写于 作者: O openharmony_ci 提交者: Gitee

!3483 Update Docs

Merge pull request !3483 from 吴冯山/master
...@@ -75,7 +75,7 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种 ...@@ -75,7 +75,7 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种
backup : false, backup : false,
autoSync : false, autoSync : false,
kvStoreType : distributedData.KVStoreType.SINGLE_VERSION, kvStoreType : distributedData.KVStoreType.SINGLE_VERSION,
securityLevel : distributedData.SecurityLevel.S2, securityLevel : distributedData.SecurityLevel.S0,
}; };
kvManager.getKVStore('storeId', options, function (err, store) { kvManager.getKVStore('storeId', options, function (err, store) {
if (err) { if (err) {
...@@ -159,18 +159,21 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种 ...@@ -159,18 +159,21 @@ OpenHarmony系统中的分布式数据服务模块为开发者提供下面几种
deviceManager.createDeviceManager("bundleName", (err, value) => { deviceManager.createDeviceManager("bundleName", (err, value) => {
if (!err) { if (!err) {
devManager = value; devManager = value;
// get deviceIds
let deviceIds = [];
if (devManager != null) {
var devices = devManager.getTrustedDeviceListSync();
for (var i = 0; i < devices.length; i++) {
deviceIds[i] = devices[i].deviceId;
}
}
try{
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
}catch (e) {
console.log("An unexpected error occurred. Error:" + e);
}
} }
}); });
// get deviceIds
let deviceIds = [];
if (devManager != null) {
var deviceList = devManager.getTrustedDeviceListSync();
for (var i = 0; i < deviceList.length; i++) {
deviceIds[i] = deviceList[i].deviceId;
}
}
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
``` ```
## 相关实例 ## 相关实例
针对分布式数据开发,有以下相关实例可供参考: 针对分布式数据开发,有以下相关实例可供参考:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册