diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 0067edf56fc45ef6dc673bf5ca0a1c7797537473..153af787003eccc4037eb0088a0e27bb5dbfa21d 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -10646,6 +10646,49 @@ declare namespace window { PAUSED = 6 } + /** + * Window stage lifecycle callback event type + * + * @enum { number } + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + enum WindowStageLifecycleEventType { + /** + * The window stage is running in the foreground. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + SHOWN = 1, + /** + * The window stage is interactive in the foreground. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + RESUMED = 2, + /** + * The window stage is not interactive in the foreground. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + PAUSED = 3, + /** + * The window stage is running in the background. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + HIDDEN = 4 + } + /** * Enum for window modality Type * @@ -11424,6 +11467,34 @@ declare namespace window { */ off(eventType: 'windowStageEvent', callback?: Callback): void; + /** + * Subscribes to the window stage lifecycle change event. + * + * @param { 'windowStageLifecycleEvent' } eventType Event type. The value is fixed at 'windowStageLifecycleEvent', indicating the window stage lifecycle change event. + * @param { Callback } callback Callback used to return the window stage lifecycle state. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300005 - This window stage is abnormal. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + on(eventType: 'windowStageLifecycleEvent', callback: Callback): void; + + /** + * Unsubscribes from the window stage lifecycle change event. + * + * @param { 'windowStageLifecycleEvent' } eventType Event type. The value is fixed at 'windowStageLifecycleEvent', indicating the window stage lifecycle change event. + * @param { Callback } [callback] Callback used to return the window stage lifecycle state. + * 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 } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300005 - This window stage is abnormal. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @stagemodelonly + * @since 20 + */ + off(eventType: 'windowStageLifecycleEvent', 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.