From 599196cca8ab9cf5533c6e438e6c142bb5d617f1 Mon Sep 17 00:00:00 2001 From: ylq121 Date: Mon, 3 Jul 2023 14:43:56 +0800 Subject: [PATCH] xiugai Signed-off-by: ylq121 --- .../reference/apis/js-apis-data-cloudData.md | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md b/zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md index 46f12ea5e5..0f304d5534 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-cloudData.md @@ -349,7 +349,7 @@ try { ### clean -static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback):void +static clean(accountId: string, appActions: {[bundleName: string]: Action}, callback: AsyncCallback<void>):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 | 是 | 回调函数。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | **示例:** ```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 +static clean(accountId: string, appActions: {[bundleName: string]: Action}): Promise<void> 清除本地数据中云信息,使用Promise异步回调。 @@ -407,23 +409,25 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}): Pro **返回值:** -| 类型 | 说明 | -| ------------- | ------------------------- | -| Promise | 无返回结果的Promise对象。 | +| 类型 | 说明 | +| ------------------- | ------------------------- | +| Promise<void> | 无返回结果的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}`); } ``` -- GitLab