rune-scroller
Version:
Lightweight, high-performance scroll animations for Svelte 5. ~2KB bundle, zero dependencies.
21 lines (20 loc) • 769 B
TypeScript
import type { IntersectionOptions } from './types';
/**
* Track element visibility with IntersectionObserver
* Updates isVisible whenever visibility changes
* @param options - IntersectionObserver configuration
* @param onVisible - Optional callback when visibility changes
*/
export declare function useIntersection(options?: IntersectionOptions, onVisible?: (isVisible: boolean) => void): {
element: HTMLElement | null;
readonly isVisible: boolean;
};
/**
* Track element visibility once (until first trigger)
* Unobserves after first visibility
* @param options - IntersectionObserver configuration
*/
export declare function useIntersectionOnce(options?: IntersectionOptions): {
element: HTMLElement | null;
readonly isVisible: boolean;
};