mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-08 07:36:38 +00:00
!9573 uiobserver添加scrollEvent-API调整
Merge pull request !9573 from 徐钦锋/uiobserverAPI
This commit is contained in:
commit
800bc4d812
48
api/@ohos.arkui.UIContext.d.ts
vendored
48
api/@ohos.arkui.UIContext.d.ts
vendored
@ -1016,6 +1016,54 @@ export class UIObserver {
|
||||
*/
|
||||
off(type: 'navDestinationUpdate', callback?: Callback<observer.NavDestinationInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the scroll event start or stop.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
|
||||
* @param { observer.ObserverOptions } options - The options object.
|
||||
* @param { Callback<observer.ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'scrollEvent', options: observer.ObserverOptions, callback: Callback<observer.ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'.
|
||||
* @param { observer.ObserverOptions } options - The options object.
|
||||
* @param { Callback<observer.ScrollEventInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
|
||||
* scroll ID will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'scrollEvent', options: observer.ObserverOptions, callback?: Callback<observer.ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the scroll event start or stop.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
|
||||
* @param { Callback<observer.ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'scrollEvent', callback: Callback<observer.ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'.
|
||||
* @param { Callback<observer.ScrollEventInfo> } [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
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'scrollEvent', callback?: Callback<observer.ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the router page in a ui context is updated.
|
||||
*
|
||||
|
136
api/@ohos.arkui.observer.d.ts
vendored
136
api/@ohos.arkui.observer.d.ts
vendored
@ -116,6 +116,34 @@ declare namespace uiObserver {
|
||||
ON_BACK_PRESS = 4
|
||||
}
|
||||
|
||||
/**
|
||||
* ScrollEvent type.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export enum ScrollEventType {
|
||||
/**
|
||||
* When the ScrollEvent start.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
SCROLL_START = 0,
|
||||
|
||||
/**
|
||||
* When the ScrollEvent stop.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
SCROLL_STOP = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* NavDestination info.
|
||||
*
|
||||
@ -156,6 +184,66 @@ declare namespace uiObserver {
|
||||
state: NavDestinationState
|
||||
}
|
||||
|
||||
/**
|
||||
* ScrollEvent info.
|
||||
*
|
||||
* @interface ScrollEventInfo
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export interface ScrollEventInfo {
|
||||
/**
|
||||
* Scroll id.
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
id: string,
|
||||
|
||||
/**
|
||||
* Changed ScrollEvent type.
|
||||
*
|
||||
* @type { ScrollEventType }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
scrollEvent: ScrollEventType,
|
||||
|
||||
/**
|
||||
* Changed ScrollEvent offset.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
offset: number
|
||||
}
|
||||
|
||||
/**
|
||||
* observer options.
|
||||
*
|
||||
* @interface ObserverOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export interface ObserverOptions {
|
||||
/**
|
||||
* component id.
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Router page info.
|
||||
*
|
||||
@ -292,6 +380,54 @@ declare namespace uiObserver {
|
||||
*/
|
||||
export function off(type: 'navDestinationUpdate', callback?: Callback<NavDestinationInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the scroll event start or stop.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
|
||||
* @param { ObserverOptions } options - The options object.
|
||||
* @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export function on(type: 'scrollEvent', options: ObserverOptions, callback: Callback<ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'.
|
||||
* @param { ObserverOptions } options - The options object.
|
||||
* @param { Callback<ScrollEventInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
|
||||
* scroll ID will be removed.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export function off(type: 'scrollEvent', options: ObserverOptions, callback?: Callback<ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the scroll event start or stop.
|
||||
*
|
||||
* @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
|
||||
* @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 12
|
||||
*/
|
||||
export function on(type: 'scrollEvent', callback: Callback<ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Removes a callback function that was previously registered with `on()`.
|
||||
*
|
||||
* @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'.
|
||||
* @param { Callback<ScrollEventInfo> } [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
|
||||
* @since 12
|
||||
*/
|
||||
export function off(type: 'scrollEvent', callback?: Callback<ScrollEventInfo>): void;
|
||||
|
||||
/**
|
||||
* Registers a callback function to be called when the router page is updated.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user