import { useCallback, useRef } from 'react';
import { clickAnywhere } from '../utilities/click-anywhere';
export var useClickAnywhere = function useClickAnywhere(cb, windowProxy) {
  var disposer = useRef();
  return useCallback(function (dom) {
    if (dom) {
      disposer.current && disposer.current();
      disposer.current = clickAnywhere(dom, cb, windowProxy);
    }
  }, [cb]);
};