@empathyco/x-components
Version:
Empathy X Components
48 lines • 1.62 kB
TypeScript
import type { Ref, SetupContext } from 'vue';
import type { XEvent } from '../../wiring/events.types';
/**
* Composable to share Scroll logic.
*
* @param props - Composable props.
* @param context - Component setup context.
* @param scrollEl - The scrolling container reference.
* @returns A throttled version of the function to store the scroll data.
* @public
*/
export declare function useScroll(props: {
/**
* Distance to the end of the scroll that when reached will emit the
* `scroll:about-to-end` event.
*
* @public
*/
distanceToBottom: number;
/**
* Positive vertical distance to still consider that the element is the first one visible.
* For example, if set to 100, after scrolling 100 pixels, the first rendered element
* will still be considered the first one.
*/
firstElementThresholdPx: number;
/**
* Time duration to ignore the subsequent scroll events after an emission.
* Higher values will decrease events precision but can prevent performance issues.
*
* @public
*/
throttleMs: number;
/**
* If true (default), sets the scroll position to the top when certain events are emitted.
*
* @public
*/
resetOnChange: boolean;
/**
* List of events that should reset the scroll when emitted.
*
* @public
*/
resetOn: XEvent | XEvent[];
}, { emit }: SetupContext<any>, scrollEl: Ref<HTMLElement | undefined>): {
throttledStoreScrollData: import("vue").ComputedRef<import("../..").ThrottleFunction<[]>>;
};
//# sourceMappingURL=use-scroll.d.ts.map