diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 69d0beedad1e139ad9a900b986a8cdb2fdcf76d0..974759caa64fcb9cebb1a6ba148dea842a0fd546 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -7589,10 +7589,29 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 12 dynamic - * @since 20 static */ on(type: 'subWindowClose', callback: Callback): void; + /** + * Subscribes to the event indicating that the child window is closed. + * This event is triggered only when the user clicks the system-provided close button in the upper right corner to close the child window. + * It is not triggered when the child window is closed in other ways. + * + * @param { Callback } callback - Callback invoked when the close button in the upper right corner of the child window is clicked. + * The internal logic of the callback function requires a return value of the Boolean type. + * The return value determines whether to continue to close the child window. + * The value true means not to close the child window, and false means to continue to close the child window. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300004 - Unauthorized operation. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + onSubWindowClose(callback: Callback): void; + /** * Unsubscribes from the event indicating that the child window is closed. * @@ -7611,10 +7630,29 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 12 dynamic - * @since 20 static */ off(type: 'subWindowClose', callback?: Callback): void; + /** + * Unsubscribes from the event indicating that the child window is closed. + * + * @param { Callback } [callback ]- Callback invoked when the close button in the upper right corner of the child window is clicked. + * The internal logic of the callback function requires a return value of the Boolean type. + * The return value determines whether to continue to close the child window. + * The value true means not to close the child window, and false means to continue to close the child window. + * If a value is passed in, the corresponding subscription is canceled. + * If no value is passed in, all subscriptions to the specified event are canceled. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300004 - Unauthorized operation. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + offSubWindowClose(callback?: Callback): void; + /** * Subscribes to the event indicating that the main window or child window will be closed. * This event is triggered only when the user clicks the close button in the system-provided title bar to close the window. @@ -7633,10 +7671,29 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 15 dynamic - * @since 20 static */ on(type: 'windowWillClose', callback: Callback>): void; + /** + * Subscribes to the event indicating that the main window or child window will be closed. + * This event is triggered only when the user clicks the close button in the system-provided title bar to close the window. + * It is not triggered when the window is closed in other ways. + * + * @param { Callback> } callback - Callback used to when the close button in the upper right corner of the window is clicked. + * The internal logic of the callback function requires a return value of the Promise type. + * In the returned Promise function, resolve(true) means not to close the window, + * and resolve(false) or reject means to continue to close the window. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300004 - Unauthorized operation. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + onWindowWillClose(callback: Callback>): void; + /** * Unsubscribes from the event indicating that the main window or child window will be closed. * @@ -7654,10 +7711,28 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 15 dynamic - * @since 20 static */ off(type: 'windowWillClose', callback?: Callback>): void; + /** + * Unsubscribes from the event indicating that the main window or child window will be closed. + * + * @param { Callback> } [callback] - Callback used to when the close button in the upper right corner of the window is clicked. + * The internal logic of the callback function requires a return value of the Promise type. + * It does not return any parameter. In the returned Promise function, + * resolve(true) means not to close the window, + * and resolve(false) or reject means to continue to close the window. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300004 - Unauthorized operation. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + offWindowWillClose(callback?: Callback>): void; + /** * Register the callback of window highlight state change * @@ -10364,10 +10439,24 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 12 dynamic - * @since 20 static */ on(type: 'windowTitleButtonRectChange', callback: Callback): void; + /** + * Subscribes to the change event of the rectangle that holds the minimize, maximize, and close buttons on the title bar of the window. + * + * @param { Callback } callback - Callback used to return the new rectangle. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + onWindowTitleButtonRectChange(callback: Callback): void; + /** * Unregister the callback of title buttons area change. * @@ -10394,10 +10483,24 @@ declare namespace window { * @syscap SystemCapability.Window.SessionManager * @atomicservice * @since 12 dynamic - * @since 20 static */ off(type: 'windowTitleButtonRectChange', callback?: Callback): void; + /** + * Unsubscribes from the change event of the rectangle that holds the minimize, maximize, and close buttons on the title bar of the window. + * + * @param { Callback } [callback] - Callback used to return the new rectangle. If a value is passed in, the corresponding subscription is canceled. + * If no value is passed in, all subscriptions to the specified event are canceled. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Incorrect parameter types; + * 2. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + offWindowTitleButtonRectChange(callback?: Callback): void; + /** * Set the window mask of window * @@ -11908,10 +12011,28 @@ declare namespace window { * @stagemodelonly * @atomicservice * @since 14 dynamic - * @since 20 static */ on(eventType: 'windowStageClose', callback: Callback): void; + /** + * Subscribes to the click event on the close button in the three-button navigation bar of the main window. + * This event is triggered when the close button in the three-button navigation bar of the main window is clicked. + * + * @param { Callback } callback - Callback invoked when the close button in the upper right corner of the main window is clicked. + * The return value determines whether to continue to close the main window. + * The value true means not to close the main window, and false means to continue to close the main window. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @stagemodelonly + * @atomicservice + * @since 22 static + */ + onWindowStageClose(callback: Callback): void; + /** * Unsubscribes from the event indicating that the main window is closed. * @@ -11929,10 +12050,27 @@ declare namespace window { * @stagemodelonly * @atomicservice * @since 14 dynamic - * @since 20 static */ off(eventType: 'windowStageClose', callback?: Callback): void; + /** + * Unsubscribes from the event indicating that the main window is closed. + * + * @param { Callback } [callback] - Callback invoked when the close button in the upper right corner of the main window is clicked. + * If a value is passed in, the corresponding subscription is canceled. + * If no value is passed in, all subscriptions to the specified event are canceled. + * @throws { BusinessError } 401 - Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @stagemodelonly + * @atomicservice + * @since 22 static + */ + offWindowStageClose(callback?: Callback): void; + /** * Disable window decoration. It must be called before loadContent. *