@react-hook/window-scroll
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -21,2 +21,4 @@ 'use strict' | ||
const win = typeof window === 'undefined' ? null : window | ||
const useWindowScroll = (fps = 30) => { | ||
@@ -28,3 +30,3 @@ const [scrollY, setThrottledScroll] = (0, _throttle.useThrottle)( | ||
) | ||
;(0, _event.default)(window, 'scroll', () => setThrottledScroll(getScrollY())) | ||
;(0, _event.default)(win, 'scroll', () => setThrottledScroll(getScrollY())) | ||
return scrollY | ||
@@ -31,0 +33,0 @@ } |
@@ -11,2 +11,3 @@ import {useThrottle} from '@react-hook/throttle' | ||
const win = typeof window === 'undefined' ? null : window | ||
export const useWindowScroll = (fps = 30) => { | ||
@@ -18,5 +19,5 @@ const [scrollY, setThrottledScroll] = useThrottle( | ||
) | ||
useEvent(window, 'scroll', () => setThrottledScroll(getScrollY())) | ||
useEvent(win, 'scroll', () => setThrottledScroll(getScrollY())) | ||
return scrollY | ||
} | ||
export default useWindowScroll |
{ | ||
"name": "@react-hook/window-scroll", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/window-scroll#readme", | ||
@@ -87,3 +87,3 @@ "repository": "github:jaredLunde/react-hook", | ||
"dependencies": { | ||
"@react-hook/event": "^1.0.4", | ||
"@react-hook/event": "^1.1.0", | ||
"@react-hook/throttle": "^2.1.2" | ||
@@ -90,0 +90,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8144
48
Updated@react-hook/event@^1.1.0