UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

14 lines (13 loc) 637 B
import { Ref } from 'vue'; /** * Sets up a basic IntersectionObserver which attaches to the provided * template ref when the component is mounted. Returns a boolean ref which * will update to match the current intersection status of the targeted * element (true if the element is in view, false if it's scrolled out of view). * If IntersectionObserver is not available, the returned ref will always be false. * * @param templateRef * @param observerOptions * @return boolean ref */ export default function useIntersectionObserver(templateRef: Ref<Element | undefined>, observerOptions: IntersectionObserverInit): Ref<boolean>;