@peersyst/react-hooks
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -22,3 +22,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
if (target) { | ||
if (target && typeof window !== "undefined") { | ||
// Get vertical scroll | ||
@@ -39,3 +39,2 @@ store.current = target.scrollY !== undefined ? target.scrollY : target.scrollTop; | ||
var defaultTarget = window; | ||
export default function useScrollTrigger() { | ||
@@ -46,4 +45,3 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
getTrigger = _options$getTrigger === void 0 ? defaultTrigger : _options$getTrigger, | ||
_options$target = options.target, | ||
target = _options$target === void 0 ? defaultTarget : _options$target, | ||
optionsTarget = options.target, | ||
other = _objectWithoutProperties(options, _excluded); | ||
@@ -61,2 +59,4 @@ | ||
useEffect(function () { | ||
var target = optionsTarget || window; | ||
var handleScroll = function handleScroll() { | ||
@@ -74,4 +74,4 @@ setTrigger(getTrigger(store, _objectSpread({ | ||
}; | ||
}, [target, getTrigger, JSON.stringify(other)]); | ||
}, [optionsTarget, getTrigger, JSON.stringify(other)]); | ||
return trigger; | ||
} |
@@ -22,3 +22,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
if (target) { | ||
if (target && typeof window !== "undefined") { | ||
// Get vertical scroll | ||
@@ -39,3 +39,2 @@ store.current = target.scrollY !== undefined ? target.scrollY : target.scrollTop; | ||
var defaultTarget = window; | ||
export default function useScrollTrigger() { | ||
@@ -46,4 +45,3 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
getTrigger = _options$getTrigger === void 0 ? defaultTrigger : _options$getTrigger, | ||
_options$target = options.target, | ||
target = _options$target === void 0 ? defaultTarget : _options$target, | ||
optionsTarget = options.target, | ||
other = _objectWithoutProperties(options, _excluded); | ||
@@ -61,2 +59,4 @@ | ||
useEffect(function () { | ||
var target = optionsTarget || window; | ||
var handleScroll = function handleScroll() { | ||
@@ -74,4 +74,4 @@ setTrigger(getTrigger(store, _objectSpread({ | ||
}; | ||
}, [target, getTrigger, JSON.stringify(other)]); | ||
}, [optionsTarget, getTrigger, JSON.stringify(other)]); | ||
return trigger; | ||
} |
@@ -22,3 +22,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
if (target) { | ||
if (target && typeof window !== "undefined") { | ||
// Get vertical scroll | ||
@@ -39,3 +39,2 @@ store.current = target.scrollY !== undefined ? target.scrollY : target.scrollTop; | ||
var defaultTarget = window; | ||
export default function useScrollTrigger() { | ||
@@ -46,4 +45,3 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
getTrigger = _options$getTrigger === void 0 ? defaultTrigger : _options$getTrigger, | ||
_options$target = options.target, | ||
target = _options$target === void 0 ? defaultTarget : _options$target, | ||
optionsTarget = options.target, | ||
other = _objectWithoutProperties(options, _excluded); | ||
@@ -61,2 +59,4 @@ | ||
useEffect(function () { | ||
var target = optionsTarget || window; | ||
var handleScroll = function handleScroll() { | ||
@@ -74,4 +74,4 @@ setTrigger(getTrigger(store, _objectSpread({ | ||
}; | ||
}, [target, getTrigger, JSON.stringify(other)]); | ||
}, [optionsTarget, getTrigger, JSON.stringify(other)]); | ||
return trigger; | ||
} |
@@ -34,3 +34,3 @@ "use strict"; | ||
if (target) { | ||
if (target && typeof window !== "undefined") { | ||
// Get vertical scroll | ||
@@ -51,4 +51,2 @@ store.current = target.scrollY !== undefined ? target.scrollY : target.scrollTop; | ||
var defaultTarget = window; | ||
function useScrollTrigger() { | ||
@@ -58,4 +56,3 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
getTrigger = _options$getTrigger === void 0 ? defaultTrigger : _options$getTrigger, | ||
_options$target = options.target, | ||
target = _options$target === void 0 ? defaultTarget : _options$target, | ||
optionsTarget = options.target, | ||
other = (0, _objectWithoutProperties2["default"])(options, _excluded); | ||
@@ -72,2 +69,4 @@ var store = (0, _react.useRef)(); | ||
(0, _react.useEffect)(function () { | ||
var target = optionsTarget || window; | ||
var handleScroll = function handleScroll() { | ||
@@ -85,4 +84,4 @@ setTrigger(getTrigger(store, _objectSpread({ | ||
}; | ||
}, [target, getTrigger, JSON.stringify(other)]); | ||
}, [optionsTarget, getTrigger, JSON.stringify(other)]); | ||
return trigger; | ||
} |
{ | ||
"name": "@peersyst/react-hooks", | ||
"author": "Peersyst", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "./node/index.js", |
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
36830
750