import type { MutableRefObject } from 'react'; import type { Pausable } from "../use-pausable/index.cjs"; import type { ElementTarget } from "../use-target-element/index.cjs"; export interface UseWebObserverOptions { /** * Start the observer immediate after calling this function * * @defaultValue true */ immediate?: boolean; /** * Additional `isSupported` judgement */ supported?: () => boolean; } export interface UseWebObserverReturns extends Pausable { /** * ref that holds the observer instance */ observerRef: MutableRefObject; /** * Check if the observer is supported in the current environment */ isSupported: boolean; } export type WebObserverType = 'IntersectionObserver' | 'MutationObserver' | 'ResizeObserver' | 'PerformanceObserver' | 'ReportingObserver'; /** * A low level React Hooks that helps to use Observer with ease. Available Observer: * * ```tsx * export type WebObserverType = * | 'IntersectionObserver' * | 'MutationObserver' * | 'ResizeObserver' * | 'PerformanceObserver' * | 'ReportingObserver' * ``` * * You should **NOT** use this Hook directly, use the high level Hooks below instead: * * - [useIntersectionObserver](https://sheinsight.github.io/react-use/reference/use-intersection-observer) * - [useMutationObserver](https://sheinsight.github.io/react-use/reference/use-mutation-observer) * - [useResizeObserver](https://sheinsight.github.io/react-use/reference/use-resize-observer) * - [usePerformanceObserver](https://sheinsight.github.io/react-use/reference/use-performance-observer) * - [useReportingObserver](https://sheinsight.github.io/react-use/reference/use-reporting-observer) * */ export declare function useWebObserver(observer: 'IntersectionObserver', target: ElementTarget, callback: IntersectionObserverCallback, options?: UseWebObserverOptions, initOptions?: IntersectionObserverInit, observerOptions?: undefined): UseWebObserverReturns; export declare function useWebObserver(observer: 'MutationObserver', target: ElementTarget, callback: MutationCallback, options?: UseWebObserverOptions, initOptions?: undefined, observerOptions?: MutationObserverInit): UseWebObserverReturns; export declare function useWebObserver(observer: 'ResizeObserver', target: ElementTarget, callback: ResizeObserverCallback, options?: UseWebObserverOptions, initOptions?: undefined, observerOptions?: ResizeObserverOptions): UseWebObserverReturns; export declare function useWebObserver(observer: 'PerformanceObserver', target: undefined, callback: PerformanceObserverCallback, options?: UseWebObserverOptions, initOptions?: undefined, observerOptions?: PerformanceObserverInit): UseWebObserverReturns; export declare function useWebObserver(observer: 'ReportingObserver', target: undefined, callback: ReportingObserverCallback, options?: UseWebObserverOptions, initOptions?: ReportingObserverOptions, observerOptions?: undefined): UseWebObserverReturns;