提交 599196cc 编写于 作者: Y ylq121

xiugai

Signed-off-by: Nylq121 <yangqing89@huawei.com>
上级 0dcdc686
......@@ -349,7 +349,7 @@ try {
### clean
static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback<void>):void
static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback&lt;void&gt;):void
清除本地数据中云信息,使用callback异步回调。
......@@ -365,30 +365,32 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}, call
| ---------- | ------------------------------------------------------------ | ---- | -------------------- |
| accountId | string | 是 | 具体打开的云ID。 |
| appActions | {[bundleName: string]: [Action](https://gitee.com/openharmony/docs/blob/0a732228c11c5b8a6620444b7778aea745054735/zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md#Action)} | 是 | 要清除数据的应用信息 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:**
```js
let con = ddm.Action;
let action = cloudData.Action;
let account = "test_id";
let appActions = { "test_bundleName1": con.CLEAR_CLOUD_INFO, "test_bundleName2": con.CLEAR_CLOUD_DATA_AND_INFO }
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
await ddm.Config.clean(account, appActions, function (err, data) {
if (err == undefined) {
console.info('Succeeding in cleaning cloud data');
} else {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`);
}
});
cloudData.Config.clean(account, appActions, function (err, data) {
if (err == undefined) {
console.info('Succeeding in cleaning cloud data');
} else {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`);
}
});
} catch (e) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
}
```
### clean
static clean(accountId: string, appActions: {[bundleName: string]: Action}): Promise<void>
static clean(accountId: string, appActions: {[bundleName: string]: Action}): Promise&lt;void&gt;
清除本地数据中云信息,使用Promise异步回调。
......@@ -407,23 +409,25 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}): Pro
**返回值:**
| 类型 | 说明 |
| ------------- | ------------------------- |
| Promise<void> | 无返回结果的Promise对象。 |
| 类型 | 说明 |
| ------------------- | ------------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
let con = ddm.Action;
let action = cloudData.Action;
let account = "test_id";
let appActions = { "test_bundleName1": con.CLEAR_CLOUD_INFO, "test_bundleName2": con.CLEAR_CLOUD_DATA_AND_INFO }
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
await ddm.Config.clean(account, appActions).then((data) => {
console.info('Succeeding in cleaning cloud data');
}).catch((error) => {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`);
});
cloudData.Config.clean(account, appActions).then((data) => {
console.info('Succeeding in cleaning cloud data');
}).catch((error) => {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`);
});
} catch (e) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册