{"version":3,"file":"index.mjs","sources":["../../src/index.tsx"],"sourcesContent":["import {useThrottle} from '@react-hook/throttle'\nimport useEvent from '@react-hook/event'\n\nconst win = typeof window === 'undefined' ? null : window\nconst getScrollY = (): number =>\n  (win as Window).scrollY !== void 0\n    ? (win as Window).scrollY\n    : (win as Window).pageYOffset === void 0\n    ? 0\n    : (win as Window).pageYOffset\n\nexport const useWindowScroll = (fps = 30): number => {\n  const state = useThrottle(\n    typeof window === 'undefined' ? 0 : getScrollY,\n    fps,\n    true\n  )\n  useEvent(win, 'scroll', (): void => state[1](getScrollY()))\n  return state[0]\n}\n\nexport default useWindowScroll\n"],"names":["win","window","getScrollY","scrollY","pageYOffset","useWindowScroll","fps","state","useThrottle","useEvent"],"mappings":"oFAGA,IAAMA,EAAwB,oBAAXC,OAAyB,KAAOA,OAC7CC,EAAa,SACW,IAA3BF,EAAeG,QACXH,EAAeG,aACgB,IAA/BH,EAAeI,YAChB,EACCJ,EAAeI,YAETC,EAAkB,SAACC,YAAAA,IAAAA,EAAM,QAC9BC,EAAQC,EACM,oBAAXP,OAAyB,EAAIC,EACpCI,EACA,UAEFG,EAAST,EAAK,SAAU,IAAYO,EAAM,GAAGL,MACtCK,EAAM"}