@empathyco/x-components
Version:
Empathy X Components
37 lines (25 loc) • 1.37 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [useScroll](./x-components.usescroll.md)
## useScroll() function
Composable to share Scroll logic.
**Signature:**
```typescript
export declare function useScroll(props: {
distanceToBottom: number;
firstElementThresholdPx: number;
throttleMs: number;
resetOnChange: boolean;
resetOn: XEvent | XEvent[];
}, { emit }: SetupContext<any>, scrollEl: Ref<HTMLElement | undefined>): {
throttledStoreScrollData: import("vue").ComputedRef<import("../..").ThrottleFunction<[]>>;
};
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| props | { distanceToBottom: number; firstElementThresholdPx: number; throttleMs: number; resetOnChange: boolean; resetOn: [XEvent](./x-components.xevent.md) \| [XEvent](./x-components.xevent.md)<!-- -->\[\]; } | Composable props. |
| { emit } | SetupContext<any> | |
| scrollEl | Ref<HTMLElement \| undefined> | The scrolling container reference. |
**Returns:**
{ throttledStoreScrollData: import("vue").ComputedRef<import("../..").[ThrottleFunction](./x-components.throttlefunction.md)<!-- --><\[\]>>; }
A throttled version of the function to store the scroll data.