diff --git a/frameworks/config_policy/ets/ani/ets/@ohos.configPolicy.ets b/frameworks/config_policy/ets/ani/ets/@ohos.configPolicy.ets index 16929ba6a38522654773b948190ccef94d16b734..689bae9518e09b4b047c052a411f39dd2d240c26 100644 --- a/frameworks/config_policy/ets/ani/ets/@ohos.configPolicy.ets +++ b/frameworks/config_policy/ets/ani/ets/@ohos.configPolicy.ets @@ -33,7 +33,7 @@ namespace configPolicy { native function getCfgDirListSync(): Array; - function getOneCfgFile(relPath: string, callback: AsyncCallback) : void { + function getOneCfgFileWithCallback(relPath: string, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath); }).then((content: NullishType) => { @@ -43,7 +43,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string, followMode: FollowXMode, callback: AsyncCallback) : void { + function getOneCfgFileWithFollowModeCallback(relPath: string, followMode: FollowXMode, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode); }).then((content: NullishType) => { @@ -53,7 +53,7 @@ namespace configPolicy { }); } - function getOneCfgFile( + function getOneCfgFileWithFollowModeExtraCallback( relPath: string, followMode: FollowXMode, extra: string, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode, extra); @@ -64,7 +64,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string): Promise { + function getOneCfgFileReturnsPromise(relPath: string): Promise { return new Promise((resolve, reject) => { taskpool.execute((): string => { return getOneCfgFileSync(relPath); @@ -76,7 +76,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string, followMode: FollowXMode, extra?: string): Promise { + function getOneCfgFileWithFollowModeReturnsPromise(relPath: string, followMode: FollowXMode, extra?: string): Promise { return new Promise((resolve, reject) => { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode, extra); @@ -88,7 +88,11 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, callback: AsyncCallback>) : void { + overload getOneCfgFile { getOneCfgFileWithCallback, getOneCfgFileWithFollowModeCallback, + getOneCfgFileWithFollowModeExtraCallback, getOneCfgFileReturnsPromise, + getOneCfgFileWithFollowModeReturnsPromise }; + + function getCfgFilesWithCallback(relPath: string, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath); }).then((content: NullishType) => { @@ -98,7 +102,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, followMode: FollowXMode, callback: AsyncCallback>) : void { + function getCfgFilesWithFollowModeCallback(relPath: string, followMode: FollowXMode, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode); }).then((content: NullishType) => { @@ -108,7 +112,7 @@ namespace configPolicy { }); } - function getCfgFiles( + function getCfgFilesWithFollowModeExtraCallback( relPath: string, followMode: FollowXMode, extra: string, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode, extra); @@ -119,7 +123,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string): Promise> { + function getCfgFilesReturnsPromise(relPath: string): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgFilesSync(relPath); @@ -131,7 +135,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, followMode: FollowXMode, extra?: string): Promise> { + function getCfgFilesWithFollowModeReturnsPromise(relPath: string, followMode: FollowXMode, extra?: string): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode, extra); @@ -143,7 +147,11 @@ namespace configPolicy { }); } - function getCfgDirList(callback: AsyncCallback>) : void { + overload getCfgFiles { getCfgFilesWithCallback, getCfgFilesWithFollowModeCallback, + getCfgFilesWithFollowModeExtraCallback, getCfgFilesReturnsPromise, + getCfgFilesWithFollowModeReturnsPromise }; + + function getCfgDirListWithCallback(callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgDirListSync(); }).then((content: NullishType) => { @@ -153,7 +161,7 @@ namespace configPolicy { }); } - function getCfgDirList(): Promise> { + function getCfgDirListReturnsPromise(): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgDirListSync(); @@ -164,6 +172,8 @@ namespace configPolicy { }); }); } + + overload getCfgDirList { getCfgDirListWithCallback, getCfgDirListReturnsPromise }; } export default configPolicy;