@stackoverfloweth/vue-compositions
Version:
A collection of reusable vue compositions.
23 lines (22 loc) • 924 B
TypeScript
import { Ref, MaybeRef } from 'vue';
type DisconnectScrollLink = () => void;
type UseScrollLinking = {
disconnect: DisconnectScrollLink;
source: Ref<HTMLElement | undefined>;
target: Ref<HTMLElement | undefined>;
};
/**
* The useScrollLinking composition takes 2 optional element references (source, target)
* and attaches a scroll event listener to the source. When the scroll event of the
* source element is fired, the scroll position of the target is updated to match, producing
* a scroll linking effect.
*
* This composition will tear down when the calling component is unmounted but can be disconnected
* early using the returned disconnect method.
*
* @param source MaybeRef<HTMLElement>
* @param target MaybeRef<HTMLElement>
* @returns UseScrollLinking
*/
export declare function useScrollLinking(source?: MaybeRef<HTMLElement>, target?: MaybeRef<HTMLElement>): UseScrollLinking;
export {};