interface ViewWatcherConfig {
    root?: null | Element;
    rootMargin?: string;
    threshold?: number | number[];
}

Properties

root?: null | Element

The root element to use for the IntersectionObserver.

NOTE: If the target you want to observe (via ViewWatcher.onView) is inside a scrolling element, then you should probably set the watcher's root to be that scrolling element or a wrapper around it. However, even if you don't or can't do that, the watcher will try to be smart about that, and when the target is no longer intercepting because it's scrolled outside its scrolling container, and yet its bounding box is still inside the watcher root (e.g. the viewport) the watcher will determine the relative view based on the scrolling container and not the actual watcher root.

null
rootMargin?: string

The rootMargin to pass to the IntersectionObserver constructor options.

"0px 0px 0px 0px"
threshold?: number | number[]

The threshold to pass to the IntersectionObserver constructor options.

0