export type FnData = (() => void); export type OnScrollFunc = (ev: Event) => void; /** * @typedef {(() => void)} FnData - Function with no arguments and no return value */ /** * A function that handles a scroll event. * It receives a standard `Event` object when a scroll occurs. * * @typedef {(ev: Event) => void} OnScrollFunc */ /** * A scroll tracker that queues functions to be executed * after the user stops scrolling a specific element or the window. * @template {Element|Window} ScrollElement */ declare class TinyAfterScrollWatcher { #private; lastScrollTime: number | undefined; get scrollTarget(): ScrollElement; get afterScrollQueueSize(): number; get destroyed(): boolean; /** * @param {ScrollElement} scrollTarget - The element or window to track scrolling on * @param {number} [inactivityTime=100] - Time in milliseconds to wait after scroll ends before executing the queue * @throws {TypeError} If scrollTarget is not a valid Element or Window * @throws {TypeError} If inactivityTime is not a positive number */ constructor(scrollTarget: ScrollElement, inactivityTime?: number); /** * @private */ private _checkTimer; /** * Gets the current inactivity time in milliseconds. * @returns {number} */ get inactivityTime(): number; /** * Sets a new inactivity time. * Must be a positive number (in milliseconds). * @param {number} value * @throws {Error} If value is not a positive number */ set inactivityTime(value: number); /** * Adds a function to be executed after scroll has stopped. * The scroll is considered "stopped" after the configured inactivity time. * * @param {() => void} fn - A function to execute once scrolling has stopped. * @throws {TypeError} If the argument is not a function. */ doAfterScroll(fn: () => void): void; /** * Registers a function to run once after scrolling has stopped, * before any afterScrollQueue functions. * * @param {FnData} fn - A function to execute after scroll stop. * @throws {TypeError} If the argument is not a function. */ onStop(fn: FnData): void; /** * Removes a previously registered onStop function. * * @param {FnData} fn - The function to remove. * @throws {TypeError} If the argument is not a function. */ offStop(fn: FnData): void; /** * Registers an external scroll listener on the tracked element. * * @param {OnScrollFunc} fn - The scroll listener to add * @throws {TypeError} If the argument is not a function. */ onScroll(fn: OnScrollFunc): void; /** * Removes a previously registered scroll listener from the tracked element. * * @param {OnScrollFunc} fn - The scroll listener to remove * @throws {TypeError} If the argument is not a function. */ offScroll(fn: OnScrollFunc): void; /** * Destroys the watcher by removing internal listeners and clearing data. */ destroy(): void; } export default TinyAfterScrollWatcher; //# sourceMappingURL=TinyAfterScrollWatcher.d.mts.map