From a1dc75c8ae2a8473b28b86e876528c16c068124c Mon Sep 17 00:00:00 2001 From: xuhangqi Date: Wed, 30 Jul 2025 20:35:22 +0800 Subject: [PATCH] refactor_overload_window8 Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICPWIJ Signed-off-by: xuhangqi Change-Id: If183884567dfca8f7e692cab1f619ae38b4f0f84 --- .../window_stage_ani/ets/@ohos.window.ets | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets index 2b198a334f..f0ee2335ce 100644 --- a/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets +++ b/interfaces/kits/ani/window_runtime/window_stage_ani/ets/@ohos.window.ets @@ -2840,7 +2840,7 @@ export class WindowInternal implements Window { return this.isWindowShowingSync(this.nativeObj); } - public hideWithAnimation(callback: AsyncCallback): void { + public hideWithAnimationWithCallback(callback: AsyncCallback): void { taskpool.execute((): void => { this.hideWithAnimationSync(this.nativeObj); }).then((ret: NullishType) => { @@ -2850,7 +2850,7 @@ export class WindowInternal implements Window { }); } - public hideWithAnimation(): Promise { + public hideWithAnimationReturnPromise(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.hideWithAnimationSync(this.nativeObj); @@ -2862,7 +2862,9 @@ export class WindowInternal implements Window { }); } - public showWithAnimation(callback: AsyncCallback): void { + overload hideWithAnimation { hideWithAnimationWithCallback, hideWithAnimationReturnPromise }; + + public showWithAnimationWithCallback(callback: AsyncCallback): void { taskpool.execute((): void => { this.showWithAnimationSync(this.nativeObj); }).then((ret: NullishType) => { @@ -2872,7 +2874,7 @@ export class WindowInternal implements Window { }); } - public showWithAnimation(): Promise { + public showWithAnimationReturnPromise(): Promise { return new Promise((resolve: (value: undefined) => void, reject: (error: BusinessError) => void): void => { taskpool.execute((): void => { this.showWithAnimationSync(this.nativeObj); @@ -2883,6 +2885,8 @@ export class WindowInternal implements Window { }); }); } + + overload showWithAnimation { showWithAnimationWithCallback, showWithAnimationReturnPromise }; } export interface Window { @@ -2962,10 +2966,12 @@ export interface Window { destroyWindow(callback: AsyncCallback): void; destroyWindow(): Promise; isWindowShowing(): boolean; - hideWithAnimation(callback: AsyncCallback): void; - hideWithAnimation(): Promise; - showWithAnimation(callback: AsyncCallback): void; - showWithAnimation(): Promise; + hideWithAnimationWithCallback(callback: AsyncCallback): void; + hideWithAnimationReturnPromise(): Promise; + overload hideWithAnimation { hideWithAnimationWithCallback, hideWithAnimationReturnPromise }; + showWithAnimationWithCallback(callback: AsyncCallback): void; + showWithAnimationReturnPromise(): Promise; + overload showWithAnimation { showWithAnimationWithCallback, showWithAnimationReturnPromise }; setWindowFocusable(isFocusable: boolean): Promise; setWindowFocusable(isFocusable: boolean, callback: AsyncCallback): void; keepKeyboardOnFocus(enable: boolean): void; -- Gitee