From d9ca83c69bd2b847a8a297bfe3f8b9eb7d199e1d Mon Sep 17 00:00:00 2001 From: yangfan229 Date: Wed, 30 Jul 2025 10:53:35 +0800 Subject: [PATCH] observer add tab content change Signed-off-by: yangfan229 Change-Id: Ib440aaacaea978d13c716ff66948c8821c6a6cd2 --- api/@ohos.arkui.observer.d.ts | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/api/@ohos.arkui.observer.d.ts b/api/@ohos.arkui.observer.d.ts index 29af3503e2..740a6b37cd 100644 --- a/api/@ohos.arkui.observer.d.ts +++ b/api/@ohos.arkui.observer.d.ts @@ -1196,6 +1196,61 @@ declare namespace uiObserver { /** * Registers a callback function to be called when the tabContent is showed or hidden. + * Include the cases when the first tab content shows and when the tab changes current index. + * + * @param { 'tabContentChange' } type - The type of event to listen for. Must be 'tabContentChange'. + * @param { ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to be called when when the tabContent is showed or hidden. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + export function on(type: 'tabContentChange', options: ObserverOptions, callback: Callback): void; + + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'tabContentChange' } type - The type of event to remove the listener for. Must be 'tabContentChange'. + * @param { ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * Tabs ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + export function off(type: 'tabContentChange', options: ObserverOptions, callback?: Callback): void; + + /** + * Registers a callback function to be called when the tabContent is showed or hidden. + * Include the cases when the first tab content shows and when the tab changes current index. + * + * @param { 'tabContentChange' } type - The type of event to listen for. Must be 'tabContentChange'. + * @param { Callback } callback - The callback function to be called when the tabContent is showed or hidden. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + export function on(type: 'tabContentChange', callback: Callback): void; + + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'tabContentChange'} type - The type of event to remove the listener for. Must be 'tabContentChange'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 22 + */ + export function off(type: 'tabContentChange', callback?: Callback): void; + + /** + * Registers a callback function to be called when the tabContent is showed or hidden. + * Only calls when the tab changes index. * * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'. * @param { ObserverOptions } options - The options object. @@ -1223,6 +1278,7 @@ declare namespace uiObserver { /** * Registers a callback function to be called when the tabContent is showed or hidden. + * Only calls when the tab changes index. * * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'. * @param { Callback } callback - The callback function to be called when the tabContent is showed or hidden. -- Gitee