use-scroll-bar
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -25,5 +25,6 @@ "use strict"; | ||
}), data = _a[0], setData = _a[1]; | ||
var isSSR = typeof window === 'undefined'; | ||
// cache last horizontal and vertical scroll positions | ||
var lastScrollX = window.scrollX; | ||
var lastScrollY = window.scrollY; | ||
var lastScrollX = isSSR ? 0 : window.scrollX; | ||
var lastScrollY = isSSR ? 0 : window.scrollY; | ||
var handler = function () { | ||
@@ -50,3 +51,3 @@ var newScrollY = window.scrollY; | ||
react_1.useEffect(function () { | ||
if (typeof window !== 'undefined') { | ||
if (!isSSR) { | ||
window.addEventListener('scroll', handler); | ||
@@ -53,0 +54,0 @@ return function () { |
{ | ||
"name": "use-scroll-bar", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Get information of window scrollbar like current position and direction of last scroll.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
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
5032
76