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 scroll position tracker that monitors and reports the real-time position of a scrollable element. The tracker should capture position data during scroll animations with high precision and provide detailed scroll analytics.
@generates
Create a tracker that continuously monitors the scroll position of an element during user interactions. The tracker should capture position updates in real-time during scroll animations, not just at the start and end of scrolling.
The tracker must collect the following information for each position update:
The tracker should provide analytics about the scroll session:
/**
* Configuration options for the scroll tracker
*/
export interface TrackerConfig {
wrapper: string | HTMLElement;
onUpdate?: (data: PositionData) => void;
}
/**
* Position data captured during scrolling
*/
export interface PositionData {
x: number;
y: number;
timestamp: number;
isScrolling: boolean;
}
/**
* Analytics data for a scroll session
*/
export interface ScrollAnalytics {
totalDistance: number;
updateCount: number;
averageFrequency: number;
duration: number;
}
/**
* ScrollTracker class for monitoring scroll position
*/
export class ScrollTracker {
constructor(config: TrackerConfig);
/**
* Get the current position
*/
getCurrentPosition(): PositionData;
/**
* Get analytics for the current session
*/
getAnalytics(): ScrollAnalytics;
/**
* Clear all collected position data
*/
reset(): void;
/**
* Clean up resources
*/
destroy(): void;
}Provides smooth momentum-based scrolling with real-time position tracking capabilities. @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