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

react-intersection-observer-hook

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-intersection-observer-hook - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

1

dist/index.d.ts

@@ -1,3 +0,2 @@

export * from './types';
export { default as useIntersectionObserver } from './useIntersectionObserver';
export { default as useTrackVisibility } from './useTrackVisibility';

2

dist/react-intersection-observer-hook.cjs.development.js

@@ -20,3 +20,3 @@ 'use strict';

var observerRef = react.useRef();
var observerRef = react.useRef(null);

@@ -23,0 +23,0 @@ var _useState = react.useState(),

@@ -1,2 +0,2 @@

"use strict";var r=require("react"),e=[0];function t(t){var n=void 0===t?{}:t,o=n.root,i=void 0===o?null:o,s=n.rootMargin,c=void 0===s?"0px":s,u=n.threshold,a=void 0===u?e:u,v=r.useRef(),f=r.useState(),l=f[0],d=f[1];return r.useEffect((function(){return function(){var r=v.current;r&&r.disconnect()}}),[]),[r.useCallback((function(r){var e=(v.current||(v.current=new IntersectionObserver((function(r){d(r[0])}),{root:i,rootMargin:c,threshold:a})),v.current);e.disconnect(),r&&e.observe(r)}),[i,c,a]),{entry:l}]}exports.useIntersectionObserver=t,exports.useTrackVisibility=function(r){var e=t(r),n=e[1].entry;return[e[0],{isVisible:Boolean(n&&n.isIntersecting)}]};
"use strict";var r=require("react"),e=[0];function t(t){var n=void 0===t?{}:t,o=n.root,i=void 0===o?null:o,s=n.rootMargin,u=void 0===s?"0px":s,c=n.threshold,a=void 0===c?e:c,v=r.useRef(null),l=r.useState(),f=l[0],d=l[1];return r.useEffect((function(){return function(){var r=v.current;r&&r.disconnect()}}),[]),[r.useCallback((function(r){var e=(v.current||(v.current=new IntersectionObserver((function(r){d(r[0])}),{root:i,rootMargin:u,threshold:a})),v.current);e.disconnect(),r&&e.observe(r)}),[i,u,a]),{entry:f}]}exports.useIntersectionObserver=t,exports.useTrackVisibility=function(r){var e=t(r),n=e[1].entry;return[e[0],{isVisible:Boolean(n&&n.isIntersecting)}]};
//# sourceMappingURL=react-intersection-observer-hook.cjs.production.min.js.map

@@ -18,3 +18,3 @@ import { useRef, useState, useEffect, useCallback } from 'react';

var observerRef = useRef();
var observerRef = useRef(null);

@@ -21,0 +21,0 @@ var _useState = useState(),

@@ -1,3 +0,7 @@

import { IntersectionObserverHookResult } from 'types';
export declare type IntersectionObserverHookRefCallbackNode = Element | null;
export declare type IntersectionObserverHookRefCallback = (node: IntersectionObserverHookRefCallbackNode) => void;
export declare type IntersectionObserverHookResult = [IntersectionObserverHookRefCallback, {
entry: IntersectionObserverEntry | undefined;
}];
declare function useIntersectionObserver({ root, rootMargin, threshold, }?: IntersectionObserverInit): IntersectionObserverHookResult;
export default useIntersectionObserver;

@@ -1,3 +0,6 @@

import { TrackVisibilityResult } from './types';
import { IntersectionObserverHookRefCallback } from './useIntersectionObserver';
export declare type TrackVisibilityResult = [IntersectionObserverHookRefCallback, {
isVisible: boolean;
}];
declare function useTrackVisibility(props?: IntersectionObserverInit): TrackVisibilityResult;
export default useTrackVisibility;
{
"name": "react-intersection-observer-hook",
"version": "1.0.3",
"version": "1.0.4",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "onderonur",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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