From abcfe06b0e114ca8d3344a3bd36b4f0231ade9e6 Mon Sep 17 00:00:00 2001 From: huangjie Date: Thu, 13 Oct 2022 17:33:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84AsyncCallback=E6=8B=93=E5=B1=95code=E6=88=90=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangjie --- api/@ohos.resourceManager.d.ts | 51 ++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/api/@ohos.resourceManager.d.ts b/api/@ohos.resourceManager.d.ts index b4f2afb22a..6b43f6b7df 100644 --- a/api/@ohos.resourceManager.d.ts +++ b/api/@ohos.resourceManager.d.ts @@ -15,7 +15,7 @@ import { RawFileDescriptor as _RawFileDescriptor } from './global/rawFileDescriptor'; import { Resource as _Resource } from './global/resource'; -import { AsyncCallback } from './basic'; +import { AsyncCallback as _AsyncCallback } from './basic'; /** * Provides resource related APIs. @@ -185,6 +185,15 @@ export class DeviceCapability { deviceType: DeviceType } +/** + * The ResourceManager callback. + * @since 6 + * @deprecated since 9 + */ + export interface AsyncCallback { + (err: Error, data: T): void; +} + /** * Obtains the ResourceManager object of the current application. * @@ -262,7 +271,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringValue(resource: Resource, callback: AsyncCallback): void; + getStringValue(resource: Resource, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource object in Promise mode. @@ -310,7 +319,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayValue(resource: Resource, callback: AsyncCallback>): void; + getStringArrayValue(resource: Resource, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource object in Promise mode. @@ -357,7 +366,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @since 9 */ - getMediaContent(resource: Resource, callback: AsyncCallback): void; + getMediaContent(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource object in Promise mode. @@ -405,7 +414,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @since 9 */ - getMediaContentBase64(resource: Resource, callback: AsyncCallback): void; + getMediaContentBase64(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in Promise mode. @@ -425,7 +434,7 @@ export interface ResourceManager { * @param callback Indicates the asynchronous callback used to return the obtained device capability. * @since 6 */ - getDeviceCapability(callback: AsyncCallback): void; + getDeviceCapability(callback: _AsyncCallback): void; /** * Obtains the device capability in Promise mode. @@ -442,7 +451,7 @@ export interface ResourceManager { * configuration. * @since 6 */ - getConfiguration(callback: AsyncCallback): void; + getConfiguration(callback: _AsyncCallback): void; /** * Obtains the device configuration in Promise mode. @@ -494,7 +503,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback): void; + getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the resource object string corresponding to @@ -589,7 +598,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringByName(resName: string, callback: AsyncCallback): void; + getStringByName(resName: string, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource name in Promise mode. @@ -615,7 +624,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayByName(resName: string, callback: AsyncCallback>): void; + getStringArrayByName(resName: string, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource name in Promise mode. @@ -640,7 +649,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001004 - If the resource not found by resName. * @since 9 */ - getMediaByName(resName: string, callback: AsyncCallback): void; + getMediaByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource name in Promise mode. @@ -665,7 +674,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001004 - If the resource not found by resName. * @since 9 */ - getMediaBase64ByName(resName: string, callback: AsyncCallback): void; + getMediaBase64ByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in Promise mode. @@ -693,7 +702,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringByName(resName: string, num: number, callback: AsyncCallback): void; + getPluralStringByName(resName: string, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the name string corresponding to @@ -846,7 +855,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringValue(resId: number, callback: AsyncCallback): void; + getStringValue(resId: number, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource ID in Promise mode. @@ -872,7 +881,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayValue(resId: number, callback: AsyncCallback>): void; + getStringArrayValue(resId: number, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. @@ -901,7 +910,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringValue(resId: number, num: number, callback: AsyncCallback): void; + getPluralStringValue(resId: number, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the ID string corresponding to @@ -929,7 +938,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by resId. * @since 9 */ - getMediaContent(resId: number, callback: AsyncCallback): void; + getMediaContent(resId: number, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. @@ -954,7 +963,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by resId. * @since 9 */ - getMediaContentBase64(resId: number, callback: AsyncCallback): void; + getMediaContentBase64(resId: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. @@ -977,7 +986,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - getRawFileContent(path: string, callback: AsyncCallback): void; + getRawFileContent(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource corresponding to the specified resource path in Promise mode. @@ -999,7 +1008,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - getRawFd(path: string, callback: AsyncCallback): void; + getRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. @@ -1021,7 +1030,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - closeRawFd(path: string, callback: AsyncCallback): void; + closeRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. -- Gitee