UNPKG

web-ui-pack

Version:
16 lines (15 loc) 814 B
export interface IScrollOptions { /** Point true if need to implement scroll by X instead of scroll by Y */ isXScroll?: boolean; /** Time between scrolls during the user-swipe on touchpads * @defaultValue 300 */ swipeDebounceMs?: number; /** Min swipe-movement in pixels when need to scroll * @defaultValue 10 */ swipeDebounceDelta?: number; /** Return true to skip scroll event (when element somehow is disabled for example) */ skip?: (ev: WheelEvent | TouchEvent, isTouchAction: boolean) => boolean; } /** Handles wheel & touch events for custom scrolling (without real scroll) * @returns remove/destroy function to remove related events */ export default function onScroll(el: HTMLElement, callback: (direction: -1 | 1) => void, options?: IScrollOptions): () => void;