@empathyco/x-components
Version:
Empathy X Components
95 lines (48 loc) • 1.61 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
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
props
</td><td>
{ distanceToBottom: number; firstElementThresholdPx: number; throttleMs: number; resetOnChange: boolean; resetOn: [XEvent](./x-components.xevent.md) \| [XEvent](./x-components.xevent.md)<!-- -->\[\]; }
</td><td>
Composable props.
</td></tr>
<tr><td>
{ emit }
</td><td>
SetupContext<any>
</td><td>
</td></tr>
<tr><td>
scrollEl
</td><td>
Ref<HTMLElement \| undefined>
</td><td>
The scrolling container reference.
</td></tr>
</tbody></table>
**Returns:**
{ throttledStoreScrollData: import("vue").ComputedRef<import("../..").[ThrottleFunction](./x-components.throttlefunction.md)<!-- --><\[\]>>; }
A throttled version of the function to store the scroll data.