@react-hook/window-size
Version:
React hooks for updating components when the size of the `window` changes.
3 lines (2 loc) • 620 B
JavaScript
import{useThrottle as e}from"@react-hook/throttle";import t from"@react-hook/event";var i={},n="undefined"==typeof window?null:window,o=n&&void 0!==n.visualViewport?n.visualViewport:null,r=()=>[document.documentElement.clientWidth,document.documentElement.clientHeight],d=function(d){void 0===d&&(d=i);var{fps:l,leading:u,initialWidth:a=0,initialHeight:c=0}=d,[m,f]=e("undefined"==typeof document?[a,c]:r,l,u),h=()=>f(r);return t(n,"resize",h),t(o,"resize",h),t(n,"orientationchange",h),m},l=e=>d(e)[1],u=e=>d(e)[0];export{l as useWindowHeight,d as useWindowSize,u as useWindowWidth};
//# sourceMappingURL=index.mjs.map