function observeResize(fn, node, {debounce}) {
    let prevWidth = null, prevHeight = null;
    let wrappedFn = (e) => {
        const {contentRect} = e[0],
            {width, height} = contentRect,
            isVisible = width !== 0 && height !== 0,
            hasChanged = width !== prevWidth || height !== prevHeight;

        if (isVisible && hasChanged) {
            prevWidth = width;
            prevHeight = height;
            fn(contentRect);
        }
    };
    if (isFinite(debounce) && debounce >= 0) {
        wrappedFn = lodashDebounce(wrappedFn, debounce);
    }

    const ret = new ResizeObserver(wrappedFn);
    ret.observe(node);
    return ret;
}
/**
 * Observe when a dom node's size changes.
 *
 * @param {function} fn - function to be called with the co-ordinates of the node.
 * @param {Object} node - The DOM node to observe
 * @param {Object} [c] - configuration object
 * @param {number} [c.debounce] - milliseconds to debounce
 * @returns {ResizeObserver} - ResizeObserver used to implement this function.
 *      be sure to call disconnect() on this when finished.
 *
 * Unlike the raw ResizeObserver implementation, this function will not run the
 * callback when the dimensions are both changed to 0 or is changed back from 0
 * to a previous size.  This is to improve performance by avoiding responding to
 * visibility changes.
 *
 *  For a hook that conveniently wraps this function see useOnResize().
 */
Observe when a dom node's size changes.
@param {function} fn - function to be called with the co-ordinates of the node.
@param {Object} node - The DOM node to observe
@param {Object} [c] - configuration object
@param {number} [c.debounce] - milliseconds to debounce
@returns {ResizeObserver} - ResizeObserver used to implement this function.
be sure to call disconnect() on this when finished.

Unlike the raw ResizeObserver implementation, this function will not run the
callback when the dimensions are both changed to 0 or is changed back from 0
to a previous size.  This is to improve performance by avoiding responding to
visibility changes.

For a hook that conveniently wraps this function see useOnResize().
Observe when a dom node ' s size changes . @param { function } fn - function to be called with the co - ordinates of the node . @param { Object } node - The DOM node to observe @param { Object } [ c ] - configuration object @param { number } [ c . debounce ] - milliseconds to debounce @returns { ResizeObserver } - ResizeObserver used to implement this function . be sure to call disconnect () on this when finished . Unlike the raw ResizeObserver implementation this function will not run the callback when the dimensions are both changed to 0 or is changed back from 0 to a previous size . This is to improve performance by avoiding responding to visibility changes . For a hook that conveniently wraps this function see useOnResize () .
function observeResize(fn, node, {debounce}) {
    let prevWidth = null, prevHeight = null;
    let wrappedFn = (e) => {
        const {contentRect} = e[0],
            {width, height} = contentRect,
            isVisible = width !== 0 && height !== 0,
            hasChanged = width !== prevWidth || height !== prevHeight;
        if (isVisible && hasChanged) {
            prevWidth = width;
            prevHeight = height;
            fn(contentRect);
        }
    };
    if (isFinite(debounce) && debounce >= 0) {
        wrappedFn = lodashDebounce(wrappedFn, debounce);
    }
    const ret = new ResizeObserver(wrappedFn);
    ret.observe(node);
    return ret;
}
function observeResize ( fn , node , { debounce } ) { let prevWidth = null , prevHeight = null ; let wrappedFn = ( e ) => { const { contentRect } = e [ 0 ] , { width , height } = contentRect , isVisible = width !== 0 && height !== 0 , hasChanged = width !== prevWidth || height !== prevHeight ; if ( isVisible && hasChanged ) { prevWidth = width ; prevHeight = height ; fn ( contentRect ) ; } } ; if ( isFinite ( debounce ) && debounce >= 0 ) { wrappedFn = lodashDebounce ( wrappedFn , debounce ) ; } const ret = new ResizeObserver ( wrappedFn ) ; ret . observe ( node ) ; return ret ; }
Observe when a dom node's size changes.
Observe when a dom node ' s size changes .