react-intersection-observer
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -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 @@ }) |
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
23282
376