svader
Version:
Create GPU-rendered Svelte components
29 lines (28 loc) • 1.03 kB
TypeScript
/**
* @template T
* @template {Record<string, any>} A
* @typedef {import("svelte/action").ActionReturn<T, A>} ActionReturn<T, A>
*/
/**
* @typedef {CustomEvent<IntersectionObserverEntry>} IntersectionEvent
* @typedef {{ "on:intersectionchanged"?: (e: IntersectionEvent) => void }} Attributes
*/
/**
* Observe all changes to the intersection of the given element with the target element, (by default the viewport).
*
* @param {Element} node
* @param {{ root?: Element | Document | null, rootMargin?: string }} [params]
* @returns {ActionReturn<void, Attributes>}
*/
export function intersectionObserver(node: Element, params?: {
root?: Element | Document | null;
rootMargin?: string;
}): ActionReturn<void, Attributes>;
/**
* <T, A>
*/
export type ActionReturn<T, A extends Record<string, any>> = import("svelte/action").ActionReturn<T, A>;
export type IntersectionEvent = CustomEvent<IntersectionObserverEntry>;
export type Attributes = {
"on:intersectionchanged"?: (e: IntersectionEvent) => void;
};