From 0651a65b953d6da80cf21967c1aa34f6f9a9035f Mon Sep 17 00:00:00 2001 From: xuhangqi Date: Mon, 28 Jul 2025 10:56:51 +0800 Subject: [PATCH] Refactor overload ohos.window4 Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICP60N Signed-off-by: xuhangqi Change-Id: Ibdff3a210fcc6c0bfd91d339d847941a0406cb37 --- api/@ohos.window.d.ts | 94 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 8 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index d3fffd2bfd..e24c4435e5 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -5196,11 +5196,27 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * */ moveWindowTo(x: int, y: int): Promise; + /** + * Set the position of a window. + * + * @param { int } x - Indicate the X-coordinate of the window. + * @param { int } y - Indicate the Y-coordinate of the window. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + moveWindowToReturnPromise(x: int, y: int): Promise; + /** * Set the position of a window. * @@ -5241,11 +5257,33 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * */ moveWindowTo(x: int, y: int, callback: AsyncCallback): void; + /** + * Set the position of a window. + * + * @param { int } x - Indicate the X-coordinate of the window. + * @param { int } y - Indicate the Y-coordinate of the window. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + moveWindowToWithCallback(x: int, y: int, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload moveWindowTo { moveWindowToReturnPromise, moveWindowToWithCallback }; + /** * Move window to the position. * @@ -5409,11 +5447,28 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * */ resize(width: int, height: int): Promise; + /** + * Set the size of a window . + * + * @param { int } width - Indicates the width of the window. The width should be greater than 0. + * @param { int } height - Indicates the height of the window. The height should be greater than 0. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + resizeReturnPromise(width: int, height: int): Promise; + /** * Set the size of a window . * @@ -5457,11 +5512,34 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 + * */ resize(width: int, height: int, callback: AsyncCallback): void; + /** + * Set the size of a window . + * + * @param { int } width - Indicates the width of the window. The width should be greater than 0. + * @param { int } height - Indicates the height of the window. The height should be greater than 0. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 20 + * @arkts 1.2 + */ + resizeWithCallback(width: int, height: int, callback: AsyncCallback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload resize { resizeReturnPromise, resizeWithCallback }; + /** * Set the size of a window. * -- Gitee