@@ -107,7 +107,9 @@ The following example shows how to implement a distributed data object synchroni
});
}
}
local_object.on("change",this.changeCallback);
// To refresh the page in changeCallback, correctly set this.changeCallback.bind(this) in
changeCallback.
```
5. Modify object attributes. The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types).
...
...
@@ -158,9 +160,9 @@ The following example shows how to implement a distributed data object synchroni
The sample code is as follows:
```js
// Unsubscribe from statusCallback.
// Unsubscribe from the online status change callback.
local_object.off("status",statusCallback);
// unsubscribe from all status change callbacks.
// Unsubscribe from all online status change callbacks.
local_object.off("status");
```
10. Remove a distributed data object from the synchronization network. After the distributed data object is removed from the network, the data changes on the local end will not be synchronized to the remote end.
...
...
@@ -169,7 +171,12 @@ The following example shows how to implement a distributed data object synchroni
```js
local_object.setSessionId("");
```
## Development Example
The following example is provided for you to better understand the development of distributed data object:
When an event occurs on a device, for example, a note is added, the tile or content of a note is changed, or the event list is cleared, the change will be synchronized to other devices in the trusted network by the Notepad app.
> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - API version 9 is a canary release for trial use. The APIs of this version may be unstable.
## Modules to Import
...
...
@@ -15,7 +15,7 @@ import storagestatistics from "@ohos.storageStatistics";
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> - The initial APIs of this module are supported since API version 9.
> - API version 9 is a canary release for trial use. The APIs of this version may be unstable.
@@ -246,7 +246,7 @@ The process of signing a HAP is as follows:
>
> For security purposes, the ECC algorithm is recommended for generating key pairs for application signing signatures. The RSA algorithm is not recommended.<br/>
> You are advised to place the HAP, profile, KS file **OpenHarmony.p12**, root CA certificate, intermediate CA certificate, and hapsigner in the same directory for easy operation.
> The **developtools_hapsigner/autosign/result/** directory has the following files:<br/>- OpenHarmony KS file **OpenHarmony.p12** <br/>- Root CA certificate **rootCA.cer**<br/>- Intermediate CA certificate **subCA.cer**<br/>- Profile signing certificate **OpenHarmonyProfileRelease.pem**
> The [**developtools_hapsigner/autosign/result**](https://gitee.com/openharmony/developtools_hapsigner/tree/master/autosign/result) directory has the following files:<br/>- OpenHarmony KS file **OpenHarmony.p12** <br/>- Root CA certificate **rootCA.cer**<br/>- Intermediate CA certificate **subCA.cer**<br/>- Profile signing certificate **OpenHarmonyProfileRelease.pem**
**1. Generate a key pair for the application signing certificate.**