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

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 5.0.2 to 5.0.3

2

dist/react-intersection-observer.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
typeof define === 'function' && define.amd ? define(['react'], factory) :
(global.reactIntersectionObserver = factory(global.React));
(global.ReactIntersectionObserver = factory(global.React));
}(this, (function (React) { 'use strict';

@@ -6,0 +6,0 @@

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.reactIntersectionObserver=t(e.React)}(this,function(a){"use strict";var d=new Map,l=new Map;function c(o){if(o){var e=d.get(o);if(e){var r=e.observerId,t=e.observer,n=r?l.get(r):t;n&&n.unobserve(o);var i=!1;r&&d.forEach(function(e,t){e&&e.observerId===r&&t!==o&&(i=!0)}),n&&!i&&(n.disconnect(),l.delete(r)),d.delete(o)}}}function f(e){e.forEach(function(e){var t=e.isIntersecting,o=e.intersectionRatio,r=e.target,n=d.get(r);if(n&&0<=o){var i=n.options,s=!1;Array.isArray(i.threshold)?s=i.threshold.some(function(e){return n.visible?e<o:e<=o}):void 0!==i.threshold&&(s=n.visible?o>i.threshold:o>=i.threshold),void 0!==t&&(s=s&&t),n.visible=s,n.callback&&n.callback(s)}})}var e=function(e,t,o,r,n,i,s,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[o,r,n,i,s,a],d=0;(c=new Error(t.replace(/%s/g,function(){return h[d++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},t=function(i){function s(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var o=arguments.length,r=Array(o),n=0;n<o;n++)r[n]=arguments[n];return(e=t=p(this,i.call.apply(i,[this].concat(r)))).state={inView:!1},t.node=null,t.handleNode=function(e){t.node&&c(t.node),t.node=e,t.observeNode()},t.handleChange=function(e){t.setState({inView:e}),t.props.onChange&&t.props.onChange(e)},p(t,e)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(s,i),s.prototype.componentDidMount=function(){"function"==typeof this.props.render&&e(this.node,'react-intersection-observer: No DOM node found. Make sure you forward "ref" to the root DOM element you want to observe, when using render prop.')},s.prototype.componentDidUpdate=function(e,t){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold||(c(this.node),this.observeNode()),t.inView!==this.state.inView&&this.state.inView&&this.props.triggerOnce&&(c(this.node),this.node=null)},s.prototype.componentWillUnmount=function(){this.node&&(c(this.node),this.node=null)},s.prototype.observeNode=function(){if(this.node){var e=this.props,t=e.threshold,o=e.root,r=e.rootMargin,n=e.rootId;!function(e,t){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{threshold:0},r=arguments[3],n=o.root,i=o.rootMargin,s=o.threshold||0;if(e&&t){var a=i?s.toString()+"_"+i:""+s.toString();n&&(a=r?r+"_"+a:null);var c=a?l.get(a):null;c||(c=new IntersectionObserver(f,o),a&&l.set(a,c));var h={callback:t,visible:!1,options:o,observerId:a,observer:a?void 0:c};d.set(e,h),c.observe(e)}}(this.node,this.handleChange,{threshold:t,root:o,rootMargin:r},n)}},s.prototype.render=function(){var e=this.props,t=e.children,o=e.render,r=e.tag,n=(e.triggerOnce,e.threshold,e.root,e.rootId,e.rootMargin,function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["children","render","tag","triggerOnce","threshold","root","rootId","rootMargin"])),i=this.state.inView;return"function"==typeof o?o({inView:i,ref:this.handleNode}):a.createElement(r,h({},n,{ref:this.handleNode}),"function"==typeof t?t(i):t)},s}(a.Component);return t.defaultProps={tag:"div",threshold:0,triggerOnce:!1},t});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.ReactIntersectionObserver=t(e.React)}(this,function(a){"use strict";var d=new Map,l=new Map;function c(o){if(o){var e=d.get(o);if(e){var r=e.observerId,t=e.observer,n=r?l.get(r):t;n&&n.unobserve(o);var i=!1;r&&d.forEach(function(e,t){e&&e.observerId===r&&t!==o&&(i=!0)}),n&&!i&&(n.disconnect(),l.delete(r)),d.delete(o)}}}function f(e){e.forEach(function(e){var t=e.isIntersecting,o=e.intersectionRatio,r=e.target,n=d.get(r);if(n&&0<=o){var i=n.options,s=!1;Array.isArray(i.threshold)?s=i.threshold.some(function(e){return n.visible?e<o:e<=o}):void 0!==i.threshold&&(s=n.visible?o>i.threshold:o>=i.threshold),void 0!==t&&(s=s&&t),n.visible=s,n.callback&&n.callback(s)}})}var e=function(e,t,o,r,n,i,s,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[o,r,n,i,s,a],d=0;(c=new Error(t.replace(/%s/g,function(){return h[d++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},p=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},t=function(i){function s(){var e,t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var o=arguments.length,r=Array(o),n=0;n<o;n++)r[n]=arguments[n];return(e=t=p(this,i.call.apply(i,[this].concat(r)))).state={inView:!1},t.node=null,t.handleNode=function(e){t.node&&c(t.node),t.node=e,t.observeNode()},t.handleChange=function(e){t.setState({inView:e}),t.props.onChange&&t.props.onChange(e)},p(t,e)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(s,i),s.prototype.componentDidMount=function(){"function"==typeof this.props.render&&e(this.node,'react-intersection-observer: No DOM node found. Make sure you forward "ref" to the root DOM element you want to observe, when using render prop.')},s.prototype.componentDidUpdate=function(e,t){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold||(c(this.node),this.observeNode()),t.inView!==this.state.inView&&this.state.inView&&this.props.triggerOnce&&(c(this.node),this.node=null)},s.prototype.componentWillUnmount=function(){this.node&&(c(this.node),this.node=null)},s.prototype.observeNode=function(){if(this.node){var e=this.props,t=e.threshold,o=e.root,r=e.rootMargin,n=e.rootId;!function(e,t){var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{threshold:0},r=arguments[3],n=o.root,i=o.rootMargin,s=o.threshold||0;if(e&&t){var a=i?s.toString()+"_"+i:""+s.toString();n&&(a=r?r+"_"+a:null);var c=a?l.get(a):null;c||(c=new IntersectionObserver(f,o),a&&l.set(a,c));var h={callback:t,visible:!1,options:o,observerId:a,observer:a?void 0:c};d.set(e,h),c.observe(e)}}(this.node,this.handleChange,{threshold:t,root:o,rootMargin:r},n)}},s.prototype.render=function(){var e=this.props,t=e.children,o=e.render,r=e.tag,n=(e.triggerOnce,e.threshold,e.root,e.rootId,e.rootMargin,function(e,t){var o={};for(var r in e)0<=t.indexOf(r)||Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r]);return o}(e,["children","render","tag","triggerOnce","threshold","root","rootId","rootMargin"])),i=this.state.inView;return"function"==typeof o?o({inView:i,ref:this.handleNode}):a.createElement(r,h({},n,{ref:this.handleNode}),"function"==typeof t?t(i):t)},s}(a.Component);return t.defaultProps={tag:"div",threshold:0,triggerOnce:!1},t});
{
"name": "react-intersection-observer",
"version": "5.0.2",
"version": "5.0.3",
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API",

@@ -5,0 +5,0 @@ "main": "dist/react-intersection-observer.cjs.js",

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