提交 fcbdc3ab 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 27ebbb69
......@@ -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:
- [Distributed Notepad](https://gitee.com/openharmony/distributeddatamgr_objectstore/tree/master/samples/distributedNotepad)
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.
......@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
>
> - 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";
getTotalSizeOfVolume(volumeUuid: string): Promise&lt;number&gt;
Asynchronously obtains the total space of the specified volume. This method uses a promise to return the result.
Asynchronously obtains the total space of the specified volume. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
......@@ -46,7 +46,7 @@ Asynchronously obtains the total space of the specified volume. This method uses
getTotalSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):void
Asynchronously obtains the total space of the specified volume. This method uses a callback to return the result.
Asynchronously obtains the total space of the specified volume. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
......@@ -62,7 +62,7 @@ Asynchronously obtains the total space of the specified volume. This method uses
```js
let uuid = "";
storagestatistics.getTotalSizeOfVolume(uuid, function(error, number){
// Do something
// Do something.
console.info("getTotalSizeOfVolume successfully:"+ number);
});
```
......@@ -73,7 +73,7 @@ Asynchronously obtains the total space of the specified volume. This method uses
getFreeSizeOfVolume(volumeUuid: string): Promise&lt;number&gt;
Asynchronously obtains the available space of the specified volume. This method uses a promise to return the result.
Asynchronously obtains the available space of the specified volume. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
......@@ -105,7 +105,7 @@ Asynchronously obtains the available space of the specified volume. This method
getFreeSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):void
Asynchronously obtains the available space of the specified volume. This method uses a callback to return the result.
Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
......@@ -121,7 +121,75 @@ Asynchronously obtains the available space of the specified volume. This method
```js
let uuid = "";
storagestatistics.getFreeSizeOfVolume(uuid, function(error, number){
// Do something
// Do something.
console.info("getFreeSizeOfVolume successfully:"+ number);
});
```
## storagestatistics.getBundleStats<sup>9+</sup>
getBundleStats(packageName: string): Promise&lt;BundleStats&gt;
Asynchronously obtains app information. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
- Parameters
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | -------- |
| packageName | string | Yes | Bundle name of the app.|
- Return value
| Type | Description |
| ------------------------------------------ | -------------------------- |
| Promise&lt;[Bundlestats](#bundlestats)&gt; | Promise used to return the app information.|
- Example
```js
let packageName = "";
storagestatistics.getBundleStats(packageName).then(function(BundleStats){
console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats));
}).catch(function(err){
console.info("getBundleStats failed with error:"+ err);
});
```
## storagestatistics.getBundleStats<sup>9+</sup>
getBundleStats(packageName: string, callback: AsyncCallback&lt;BundleStats&gt;): void
Asynchronously obtains app information. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
- Parameters
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------ |
| packageName | string | Yes | Bundle name of the app.|
| callback | callback:AsyncCallback&lt;[Bundlestats](#bundlestats)&gt; | Yes | Callback invoked to return the app information.|
- Example
```js
let packageName = "";
storagestatistics.getBundleStats(packageName, function(error, BundleStats){
// Do something.
console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats));
});
```
## BundleStats<sup>9+</sup>
**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics
### Attributes
| Name | Type | Description |
| --------- | ------ | -------------- |
| appSize<sup>9+</sup> | number | Size of the app. |
| cacheSize<sup>9+</sup> | number | Cache size of the app. |
| dataSize<sup>9+</sup> | number | Total data size of the app.|
......@@ -2,8 +2,8 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
>
> - 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.
## Modules to Import
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册