UNPKG

video-ad-sdk

Version:

VAST/VPAID SDK that allows video ads to be played on top of any player

33 lines (32 loc) 1.09 kB
type Callback = () => void; /** * onElementVisibilityChange callback called whenever the target element change the visibility. * * @ignore * @param isVisible true if the target element is visible and false otherwise. */ type VisibilityCallback = (isVisible?: boolean) => void; interface VisibilityObserverOptions { /** * Sets a debounce threshold for the callback. Defaults to 100 milliseconds. */ threshold?: number; /** * Offset fraction. Percentage of the element that needs to be hidden to be considered not visible. * Defaults to 0.4 */ viewabilityOffset?: number; } /** * Helper function to know if the visibility of an element has changed. * * @ignore * * @param target The element that we want to observe. * @param callback The callback that handles the visibility change. * @param options Options Map. * * @returns Unsubscribe function. */ export declare const onElementVisibilityChange: (target: HTMLElement, callback: VisibilityCallback, { threshold, viewabilityOffset }?: VisibilityObserverOptions) => Callback; export {};