A TypeScript plugin for BetterScroll that provides enhanced mouse wheel scrolling capabilities with configurable speed, direction, easing, and boundary damping on PC platforms.
Overall
score
98%
Build a module that monitors and tracks scroll lifecycle events in a scrollable container, providing detailed analytics about user scrolling behavior.
Tracks all phases of the scrolling lifecycle and records them in chronological order.
Captures relevant information for each scroll event.
Provides methods to query and analyze the tracked events.
@generates
interface ScrollEvent {
type: 'beforeScrollStart' | 'scrollStart' | 'scroll' | 'scrollEnd';
timestamp: number;
position?: { x: number; y: number };
}
export class ScrollTracker {
/**
* Initializes the scroll tracker with a scrollable element.
* Sets up event listeners to track all scroll lifecycle events.
*
* @param element - The DOM element to attach the scroller to
*/
constructor(element: HTMLElement);
/**
* Returns all tracked scroll events in chronological order.
*
* @returns Array of scroll events
*/
getEvents(): ScrollEvent[];
/**
* Returns the count of occurrences for each event type.
*
* @returns Object with event types as keys and counts as values
*/
getEventCounts(): Record<string, number>;
/**
* Clears all tracked events from memory.
*/
clearEvents(): void;
/**
* Cleanup method to remove event listeners and destroy the scroller instance.
*/
destroy(): void;
}A mobile-first scrolling library that provides smooth, momentum-based scrolling with comprehensive event lifecycle support including beforeScrollStart, scrollStart, scroll, and scrollEnd events.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-better-scroll--mouse-wheeldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10