"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useResizeObserver = void 0;
const react_1 = require("react");
const types_1 = require("@blackglory/types");
function useResizeObserver(callback, refs) {
    const deps = refs.map(x => x.current);
    (0, react_1.useEffect)(() => {
        const observer = new ResizeObserver(callback);
        refs
            .map(x => x.current)
            .filter(types_1.isntNull)
            .forEach(x => observer.observe(x));
        return () => observer.disconnect();
    }, deps);
}
exports.useResizeObserver = useResizeObserver;
//# sourceMappingURL=use-resize-observer.js.map