Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-hook/window-scroll

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/window-scroll - npm Package Compare versions

Comparing version 1.1.5 to 1.2.0

20

dist/main/index.js

@@ -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

3

package.json
{
"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 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc