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

!7696 【轻量级 PR】:【OpenHarmony开源贡献者计划2022】database/database-distributedobject-guidelines.md. 修改代码格式

Merge pull request !7696 from 张齐齐/N/A
......@@ -130,7 +130,7 @@
```js
//发起方
var local_object = distributedObject.createDistributedObject({name:"jack", age:18, isVis:true,
parent:{mother:"jack mom",father:"jack Dad"},list:[{mother:"jack mom"}, {father:"jack Dad"}]});
parent:{mother:"jack mom", father:"jack Dad"}, list:[{mother:"jack mom"}, {father:"jack Dad"}]});
local_object.setSessionId(sessionId);
//被拉起方
......@@ -166,7 +166,7 @@
local_object.name = "jack";
local_object.age = 19;
local_object.isVis = false;
local_object.parent = {mother:"jack mom",father:"jack Dad"};
local_object.parent = {mother:"jack mom", father:"jack Dad"};
local_object.list = [{mother:"jack mom"}, {father:"jack Dad"}];
```
......@@ -210,14 +210,14 @@
```js
// 保存数据对象
local_object.save("local", (result, data)=>{
local_object.save("local", (result, data) => {
console.log("save callback");
console.info("save sessionId " + data.sessionId);
console.info("save version " + data.version);
console.info("save deviceId " + data.deviceId);
});
// 撤回保存的数据对象
local_object.revokeSave((result, data) =>{
local_object.revokeSave((result, data) => {
console.log("revokeSave callback");
console.info("revokeSave sessionId " + data.sessionId);
});
......@@ -225,7 +225,7 @@
2.Promise方式
```js
// 保存数据对象
g_object.save("local").then((result)=>{
g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId);
......@@ -233,7 +233,7 @@
console.info("save local failed.");
});
// 撤回保存的数据对象
g_object.revokeSave().then((result)=>{
g_object.revokeSave().then((result) => {
console.info("revokeSave success.");
}, (result)=>{
console.info("revokeSave failed.");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册