docs(web): JSDoc comments for svelte actions (#12963)

* Web: JSDoc comments for Actions

* Remove comment
This commit is contained in:
Spencer Fasulo
2024-09-26 21:41:22 -04:00
committed by GitHub
parent 42ad3e6bb0
commit c86fa81e47
7 changed files with 37 additions and 0 deletions
@@ -13,7 +13,9 @@ type OnIntersectCallback = (entryOrElement: IntersectionObserverEntry | HTMLElem
type OnSeparateCallback = (element: HTMLElement) => unknown;
type IntersectionObserverActionProperties = {
key?: string;
/** Function to execute when the element leaves the viewport */
onSeparate?: OnSeparateCallback;
/** Function to execute when the element enters the viewport */
onIntersect?: OnIntersectCallback;
root?: Element | Document | null;
@@ -112,6 +114,12 @@ function _intersectionObserver(
};
}
/**
* Monitors an element's visibility in the viewport and calls functions when it enters or leaves (based on a threshold).
* @param element
* @param properties One or multiple configurations for the IntersectionObserver(s)
* @returns
*/
export function intersectionObserver(
element: HTMLElement,
properties: IntersectionObserverActionProperties | IntersectionObserverActionProperties[],