1 | /**
|
2 | * Observe mutations on a DOM node or tree of DOM nodes.
|
3 | * Depends on the `MutationObserver` api.
|
4 | *
|
5 | * ```ts
|
6 | * const [element, attachRef] = useCallbackRef(null);
|
7 | *
|
8 | * useMutationObserver(element, { subtree: true }, (records) => {
|
9 | *
|
10 | * });
|
11 | *
|
12 | * return (
|
13 | * <div ref={attachRef} />
|
14 | * )
|
15 | * ```
|
16 | *
|
17 | * @param element The DOM element to observe
|
18 | * @param config The observer configuration
|
19 | * @param callback A callback fired when a mutation occurs
|
20 | */
|
21 | declare function useMutationObserver(element: Element | null | undefined, config: MutationObserverInit, callback: MutationCallback): void;
|
22 | export default useMutationObserver;
|