Files
Speedtest-Tracker/conf/site/node_modules/@restart/hooks/cjs/useMutationObserver.d.ts
Henry Whitaker ea5808047f Tweaked gitignore
gitignore removed all composer and npm files, so automated builds would fail
2020-04-12 21:24:03 +01:00

23 lines
634 B
TypeScript

/**
* Observe mutations on a DOM node or tree of DOM nodes.
* Depends on the `MutationObserver` api.
*
* ```ts
* const [element, attachRef] = useCallbackRef(null);
*
* useMutationObserver(element, { subtree: true }, (records) => {
*
* });
*
* return (
* <div ref={attachRef} />
* )
* ```
*
* @param element The DOM element to observe
* @param config The observer configuration
* @param callback A callback fired when a mutation occurs
*/
declare function useMutationObserver(element: Element | null | undefined, config: MutationObserverInit, callback: MutationCallback): void;
export default useMutationObserver;