From 68f3906ef7034b9db12c07364069afa89581cda3 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 30 May 2022 21:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=A4=B1=E8=B4=A5=E4=BF=AE=E6=94=B9=20networ?= =?UTF-8?q?kid=20->networkId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wufengshan --- .../apis/js-apis-data-distributedobject.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index f1979534eb..8903e88945 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -31,7 +31,7 @@ createDistributedObject(source: object): DistributedObject **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; // 创建对象,对象包含4个属性类型,string,number,boolean和Object var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); @@ -53,7 +53,7 @@ genSessionId(): string **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; var sessionId = distributedObject.genSessionId(); ``` @@ -85,7 +85,7 @@ setSessionId(sessionId?: string): boolean **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); //g_object加入分布式组网 @@ -111,7 +111,7 @@ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<stri **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("change", function (sessionId, changeData) { @@ -136,22 +136,22 @@ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<st | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 事件类型,固定为'change',表示数据变更。 | - | callback | Callback<{ sessionId: string, fields: Array<string> }> | 否 | 需要删除的变更回调,若不设置则删除该对象所有的变更回调。
sessionId:标识变更对象的sessionId;
fields:标识对象变更的属性名。 | + | callback | Callback<{ sessionId: string, fields: Array<string> }> | 否 | 需要删除的变更回调,若不设置则删除该对象所有的数据变更回调。
sessionId:标识变更对象的sessionId;
fields:标识对象变更的属性名。 | **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("change", function (sessionId, changeData) { console.info("change" + sessionId); }); - //删除变更回调changeCallback + //删除数据变更回调changeCallback g_object.off("change", function (sessionId, changeData) { console.info("change" + sessionId); }); - //删除所有的变更回调 + //删除所有的数据变更回调 g_object.off("change"); ``` @@ -171,10 +171,10 @@ on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, st **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); - g_object.on("status", function (sessionId, networkid, status) { + g_object.on("status", function (sessionId, networkId, status) { this.response += "status changed " + sessionId + " " + status + " " + networkId; }); ``` @@ -197,7 +197,7 @@ off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, s **示例:** ```js - import distributedObject from '@ohos.data.distributedDataObject' + import distributedObject from '@ohos.data.distributedDataObject'; g_object.on("status", function (sessionId, networkId, status) { this.response += "status changed " + sessionId + " " + status + " " + networkId; }); -- GitLab