New source found from dndbeyond.com
This commit is contained in:
+4
-8
@@ -35,8 +35,7 @@ var Observables = ({
|
||||
const found = resizeObservables.find(
|
||||
(observable) => node.matches(observable)
|
||||
);
|
||||
if (found)
|
||||
setMutationsCounter(mutationsCounter + 1);
|
||||
if (found) setMutationsCounter(mutationsCounter + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,8 +89,7 @@ function getRect(element) {
|
||||
function useRect(ref, refresher) {
|
||||
const [dimensions, setDimensions] = useState2(initialState);
|
||||
const handleResize = useCallback(() => {
|
||||
if (!(ref == null ? void 0 : ref.current))
|
||||
return;
|
||||
if (!(ref == null ? void 0 : ref.current)) return;
|
||||
setDimensions(getRect(ref == null ? void 0 : ref.current));
|
||||
}, [ref == null ? void 0 : ref.current]);
|
||||
useEffect2(() => {
|
||||
@@ -104,8 +102,7 @@ function useRect(ref, refresher) {
|
||||
function useElemRect(elem, refresher) {
|
||||
const [dimensions, setDimensions] = useState2(initialState);
|
||||
const handleResize = useCallback(() => {
|
||||
if (!elem)
|
||||
return;
|
||||
if (!elem) return;
|
||||
setDimensions(getRect(elem));
|
||||
}, [elem]);
|
||||
useEffect2(() => {
|
||||
@@ -168,8 +165,7 @@ function useIntersectionObserver(elementRef, {
|
||||
useEffect3(() => {
|
||||
const node = elementRef == null ? void 0 : elementRef.current;
|
||||
const hasIOSupport = !!window.IntersectionObserver;
|
||||
if (!hasIOSupport || frozen || !node)
|
||||
return;
|
||||
if (!hasIOSupport || frozen || !node) return;
|
||||
const observerParams = { threshold, root, rootMargin };
|
||||
const observer = new IntersectionObserver(updateEntry, observerParams);
|
||||
observer.observe(node);
|
||||
|
||||
Reference in New Issue
Block a user