未验证 提交 ee06459f 编写于 作者: O openharmony_ci 提交者: Gitee

!22418 [翻译完成】#I7OYPL (只涉及代码修改)

Merge pull request !22418 from Annie_wang/PR21461
......@@ -16,7 +16,7 @@ This module provides the following common functions:
import cloudData from '@ohos.data.cloudData';
```
## Action
## ClearAction
Enumerates the actions to take to clear the downloaded cloud data locally.
......@@ -347,9 +347,9 @@ try {
}
```
### clean
### clear
static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback<void>):void
static clear(accountId: string, appActions: {[bundleName: string]: ClearAction}, callback: AsyncCallback<void>):void
Clears the cloud data locally. This API uses an asynchronous callback to return the result.
......@@ -361,26 +361,26 @@ Clears the cloud data locally. This API uses an asynchronous callback to return
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ----------------------------------------- | ---- | -------------------------------- |
| accountId | string | Yes | ID of the cloud account. |
| appActions | {[bundleName: string]: [Action](#action)} | Yes | Information about the application whose data is to be cleared and the action to take.|
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------------------- | ---- | -------------------------------- |
| accountId | string | Yes | ID of the cloud account. |
| appActions | {[bundleName: string]: [ClearAction](#clearaction)} | Yes | Information about the application whose data is to be cleared and the action to take.|
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
**Example**
```js
let action = cloudData.Action;
let action = cloudData.ClearAction;
let account = "test_id";
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
cloudData.Config.clean(account, appActions, function (err) {
cloudData.Config.clear(account, appActions, function (err) {
if (err === undefined) {
console.info('Succeeding in cleaning cloud data');
console.info('Succeeding in clearing cloud data');
} else {
console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
console.error(`Failed to clear cloud data. Code: ${err.code}, message: ${err.message}`);
}
});
} catch (error) {
......@@ -388,9 +388,9 @@ try {
}
```
### clean
### clear
static clean(accountId: string, appActions: {[bundleName: string]: Action}): Promise<void>
static clear(accountId: string, appActions: {[bundleName: string]: ClearAction}): Promise<void>
Clears the cloud data locally. This API uses a promise to return the result.
......@@ -402,10 +402,10 @@ Clears the cloud data locally. This API uses a promise to return the result.
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ----------------------------------------- | ---- | -------------------------------- |
| accountId | string | Yes | ID of the cloud account. |
| appActions | {[bundleName: string]: [Action](#action)} | Yes | Information about the application whose data is to be cleared and the action to take.|
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------------------- | ---- | -------------------------------- |
| accountId | string | Yes | ID of the cloud account. |
| appActions | {[bundleName: string]: [ClearAction](#clearaction)} | Yes | Information about the application whose data is to be cleared and the action to take.|
**Return value**
......@@ -416,16 +416,16 @@ Clears the cloud data locally. This API uses a promise to return the result.
**Example**
```js
let action = cloudData.Action;
let action = cloudData.ClearAction;
let account = "test_id";
let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try {
cloudData.Config.clean(account, appActions).then(() => {
console.info('Succeeding in cleaning cloud data');
cloudData.Config.clear(account, appActions).then(() => {
console.info('Succeeding in clearing cloud data');
}).catch((err) => {
console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
console.error(`Failed to clear cloud data. Code: ${err.code}, message: ${err.message}`);
});
} catch (error) {
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.
先完成此消息的编辑!
想要评论请 注册