提交 ad8d051f 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 53a51aae
......@@ -17,7 +17,7 @@ Call **createDistributedObject()** to create a distributed data object instance.
**Table 1** API for creating a distributed data object instance
| Bundle Name| API| Description|
| Package | API| Description|
| -------- | -------- | -------- |
| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.<br>- **source**: attributes of the distributed data object to create.<br>- **DistributedObject**: returns the distributed data object created.|
......@@ -27,7 +27,7 @@ Call **genSessionId()** to generate a session ID randomly. The generated session
**Table 2** API for generating a session ID randomly
| Bundle Name| API| Description|
| Package | API| Description|
| -------- | -------- | -------- |
| ohos.data.distributedDataObject| genSessionId(): string | Generates a session ID, which can be used as the session ID of a distributed data object.|
......@@ -201,7 +201,7 @@ The following example shows how to implement distributed data object synchroniza
});
}
}
// To refresh the page in changeCallback, correctly bind (this) to the changeCallback.
localObject.on("change", this.changeCallback.bind(this));
```
......
......@@ -113,22 +113,20 @@ You can use the following APIs to delete a **Preferences** instance or data file
```ts
// Obtain the context.
import UIAbility from '@ohos.app.ability.UIAbility'
let context = null;
import UIAbility from '@ohos.app.ability.UIAbility';
let preferences = null;
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage){
context = this.context;
onWindowStageCreate(windowStage) {
let promise = data_preferences.getPreferences(this.context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
}
}
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
```
3. Write data.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册