@react-hook/window-scroll
Advanced tools
Comparing version 1.1.5 to 1.2.0
@@ -6,6 +6,6 @@ 'use strict' | ||
var _react = _interopRequireDefault(require('react')) | ||
var _throttle = require('@react-hook/throttle') | ||
var _event = _interopRequireDefault(require('@react-hook/event')) | ||
function _interopRequireDefault(obj) { | ||
@@ -15,5 +15,2 @@ return obj && obj.__esModule ? obj : {default: obj} | ||
const {useEffect} = _react.default | ||
const emptyArr = [] | ||
const getScrollY = () => | ||
@@ -32,14 +29,3 @@ window.scrollY !== void 0 | ||
) | ||
function _ref() { | ||
return setThrottledScroll(getScrollY()) | ||
} | ||
useEffect(() => { | ||
const handleScroll = _ref | ||
window.addEventListener('scroll', handleScroll) | ||
return () => { | ||
window.removeEventListener('scroll', handleScroll) | ||
} | ||
}, emptyArr) | ||
;(0, _event.default)(window, 'scroll', () => setThrottledScroll(getScrollY())) | ||
return scrollY | ||
@@ -46,0 +32,0 @@ } |
@@ -1,5 +0,3 @@ | ||
import React from 'react' | ||
const {useEffect} = React | ||
import {useThrottle} from '@react-hook/throttle' | ||
const emptyArr = [] | ||
import useEvent from '@react-hook/event' | ||
@@ -19,16 +17,5 @@ const getScrollY = () => | ||
) | ||
function _ref() { | ||
return setThrottledScroll(getScrollY()) | ||
} | ||
useEffect(() => { | ||
const handleScroll = _ref | ||
window.addEventListener('scroll', handleScroll) | ||
return () => { | ||
window.removeEventListener('scroll', handleScroll) | ||
} | ||
}, emptyArr) | ||
useEvent(window, 'scroll', () => setThrottledScroll(getScrollY())) | ||
return scrollY | ||
} | ||
export default useWindowScroll |
{ | ||
"name": "@react-hook/window-scroll", | ||
"version": "1.1.5", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/window-scroll#readme", | ||
@@ -87,2 +87,3 @@ "repository": "github:jaredLunde/react-hook", | ||
"dependencies": { | ||
"@react-hook/event": "^1.0.3", | ||
"@react-hook/throttle": "^2.1.2" | ||
@@ -89,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
8033
3
46
+ Added@react-hook/event@^1.0.3
+ Added@react-hook/event@1.2.6(transitive)