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

@nextui-org/use-scroll-position

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextui-org/use-scroll-position - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

4

dist/index.d.ts
type ScrollValue = {
x: any;
y: any;
x: number;
y: number;
};

@@ -5,0 +5,0 @@ interface UseScrollPositionOptions {

@@ -41,4 +41,4 @@ "use strict";

);
let throttleTimeout = null;
const handler = () => {
const throttleTimeout = (0, import_react.useRef)(null);
const handler = (0, import_react.useCallback)(() => {
const currPos = getScrollPosition(elementRef == null ? void 0 : elementRef.current);

@@ -49,4 +49,4 @@ if (typeof callback === "function") {

position.current = currPos;
throttleTimeout = null;
};
throttleTimeout.current = null;
}, [callback, elementRef]);
(0, import_react.useEffect)(() => {

@@ -57,4 +57,4 @@ if (!isEnabled)

if (delay) {
if (throttleTimeout === null) {
throttleTimeout = setTimeout(handler, delay);
if (throttleTimeout.current === null) {
throttleTimeout.current = setTimeout(handler, delay);
}

@@ -67,4 +67,9 @@ } else {

target.addEventListener("scroll", handleScroll);
return () => target.removeEventListener("scroll", handleScroll);
}, [elementRef == null ? void 0 : elementRef.current, delay, isEnabled]);
return () => {
target.removeEventListener("scroll", handleScroll);
if (throttleTimeout.current) {
clearTimeout(throttleTimeout.current);
}
};
}, [elementRef == null ? void 0 : elementRef.current, delay, handler, isEnabled]);
return position.current;

@@ -71,0 +76,0 @@ };

{
"name": "@nextui-org/use-scroll-position",
"version": "2.0.5",
"version": "2.0.6",
"description": "Provides the logic to control the scroll over an element",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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