Socket
Socket
Sign inDemoInstall

react-intersection-observer

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-intersection-observer - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

12

lib/intersection.js

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

* Stop observing an element. If an element is removed from the DOM or otherwise destroyed,
* make sure to call this method. This is called automatically if an element has "removeWhenVisible" set to true.
* make sure to call this method.
* @param element {HTMLElement}

@@ -76,3 +76,2 @@ */

var callback = _INSTANCE_MAP$get.callback;
var removeWhenVisible = _INSTANCE_MAP$get.removeWhenVisible;
var visible = _INSTANCE_MAP$get.visible;

@@ -90,12 +89,11 @@ var threshold = _INSTANCE_MAP$get.threshold;

if (callback) {
callback(inView);
}
INSTANCE_MAP.set(intersection.target, {
callback: callback,
removeWhenVisible: removeWhenVisible,
visible: inView,
threshold: threshold
});
if (callback) {
callback(inView);
}
}

@@ -102,0 +100,0 @@ });

{
"name": "react-intersection-observer",
"version": "0.2.5",
"version": "0.2.6",
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -33,3 +33,3 @@ if (global.window && !process.env.SERVER) {

* Stop observing an element. If an element is removed from the DOM or otherwise destroyed,
* make sure to call this method. This is called automatically if an element has "removeWhenVisible" set to true.
* make sure to call this method.
* @param element {HTMLElement}

@@ -64,8 +64,5 @@ */

if (INSTANCE_MAP.has(intersection.target)) {
const {
callback,
removeWhenVisible,
visible,
threshold,
} = INSTANCE_MAP.get(intersection.target)
const { callback, visible, threshold } = INSTANCE_MAP.get(
intersection.target,
)
let inView

@@ -82,12 +79,11 @@ if (typeof intersection.isIntersecting === 'boolean') {

if (callback) {
callback(inView)
}
INSTANCE_MAP.set(intersection.target, {
callback,
removeWhenVisible,
visible: inView,
threshold,
})
if (callback) {
callback(inView)
}
}

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