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

intersection-events

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intersection-events - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

10

dist/intersection-events.es.js
/*!
* intersection-events v0.2.3
* intersection-events v0.2.4
* https://github.com/ko-yelie/intersection-events#readme

@@ -62,2 +62,10 @@ *

var isOnce = options.isOnce; if ( isOnce === void 0 ) isOnce = false;
if (!IntersectionObserver) {
getElements(target).forEach(function (el) {
onEnter(el);
});
return;
}
var enterThreshold = options.enterThreshold; if ( enterThreshold === void 0 ) enterThreshold = MAX_THRESHOLD;

@@ -64,0 +72,0 @@ var leaveThreshold = options.leaveThreshold; if ( leaveThreshold === void 0 ) leaveThreshold = 0;

/*!
* intersection-events v0.2.3
* intersection-events v0.2.4
* https://github.com/ko-yelie/intersection-events#readme

@@ -65,2 +65,10 @@ *

var isOnce = options.isOnce; if ( isOnce === void 0 ) isOnce = false;
if (!IntersectionObserver) {
getElements(target).forEach(function (el) {
onEnter(el);
});
return;
}
var enterThreshold = options.enterThreshold; if ( enterThreshold === void 0 ) enterThreshold = MAX_THRESHOLD;

@@ -67,0 +75,0 @@ var leaveThreshold = options.leaveThreshold; if ( leaveThreshold === void 0 ) leaveThreshold = 0;

4

dist/intersection-events.iife.min.js
/*!
* intersection-events v0.2.3
* intersection-events v0.2.4
* https://github.com/ko-yelie/intersection-events#readme

@@ -9,2 +9,2 @@ *

*/
var IntersectionEvents=function(){"use strict";function e(){}function n(e){return e?Array.prototype.slice.call(e,0):[]}return function(t,r){void 0===r&&(r={});var i=r.onEnter,s=r.onLeave;void 0===s&&(s=e);var o=r.isOnce;void 0===o&&(o=!1);var c=r.enterThreshold;void 0===c&&(c=.99);var v,a,u=r.leaveThreshold;void 0===u&&(u=0),1===c&&(c=.99),1===u&&(u=.99),c===u?(v=function(e){return e.isIntersecting},a=function(e){return 0===u?!e.isIntersecting:e.isIntersecting}):(v=function(e){return Math.abs(e.intersectionRatio-c)<=Math.abs(e.intersectionRatio-u)},a=function(e){return Math.abs(e.intersectionRatio-c)>=Math.abs(e.intersectionRatio-u)});var E=function(e){e.forEach(function(e){var n=e.target;!n.intersectionEvents.isEnter&&v(e)?(n.intersectionEvents.isEnter=!0,i(n),o&&n.intersectionEvents.observer.unobserve(n)):n.intersectionEvents.isEnter&&a(e)&&(n.intersectionEvents.isEnter=!1,s(n))})},f=new IntersectionObserver(E,{threshold:[u,c]});(function(e,t){return void 0===t&&(t=document),"string"==typeof e?n(t.querySelectorAll(e)):e.length?e.map?e:n(e):[e]})(t).forEach(function(e){e.intersectionEvents={},e.intersectionEvents.isEnter=!1;var n=window.innerHeight/e.offsetHeight,t=c>n,r=u>n;e.intersectionEvents.observer=f,(t||r)&&(e.intersectionEvents.observer=new IntersectionObserver(E,{threshold:[r?u*n:u,t?c*n:c]})),e.intersectionEvents.observer.observe(e)})}}();
var IntersectionEvents=function(){"use strict";function e(){}function n(e){return e?Array.prototype.slice.call(e,0):[]}function t(e,t){return void 0===t&&(t=document),"string"==typeof e?n(t.querySelectorAll(e)):e.length?e.map?e:n(e):[e]}return function(n,r){void 0===r&&(r={});var i=r.onEnter,s=r.onLeave;void 0===s&&(s=e);var o=r.isOnce;if(void 0===o&&(o=!1),IntersectionObserver){var c=r.enterThreshold;void 0===c&&(c=.99);var v,a,u=r.leaveThreshold;void 0===u&&(u=0),1===c&&(c=.99),1===u&&(u=.99),c===u?(v=function(e){return e.isIntersecting},a=function(e){return 0===u?!e.isIntersecting:e.isIntersecting}):(v=function(e){return Math.abs(e.intersectionRatio-c)<=Math.abs(e.intersectionRatio-u)},a=function(e){return Math.abs(e.intersectionRatio-c)>=Math.abs(e.intersectionRatio-u)});var f=function(e){e.forEach(function(e){var n=e.target;!n.intersectionEvents.isEnter&&v(e)?(n.intersectionEvents.isEnter=!0,i(n),o&&n.intersectionEvents.observer.unobserve(n)):n.intersectionEvents.isEnter&&a(e)&&(n.intersectionEvents.isEnter=!1,s(n))})},E=new IntersectionObserver(f,{threshold:[u,c]});t(n).forEach(function(e){e.intersectionEvents={},e.intersectionEvents.isEnter=!1;var n=window.innerHeight/e.offsetHeight,t=c>n,r=u>n;e.intersectionEvents.observer=E,(t||r)&&(e.intersectionEvents.observer=new IntersectionObserver(f,{threshold:[r?u*n:u,t?c*n:c]})),e.intersectionEvents.observer.observe(e)})}else t(n).forEach(function(e){i(e)})}}();
{
"name": "intersection-events",
"moduleName": "IntersectionEvents",
"version": "0.2.3",
"version": "0.2.4",
"description": "Wrapper of IntersectionObserver",

@@ -6,0 +6,0 @@ "main": "dist/intersection-events.es.js",

@@ -22,3 +22,3 @@ # intersection-events

[unpkg](https://unpkg.com/intersection-events) (1.5 KB)
[unpkg](https://unpkg.com/intersection-events) (1.6 KB)

@@ -61,3 +61,3 @@ ```html

## Note
### Note

@@ -64,0 +64,0 @@ If you need to support browsers that do **not** support `IntersectionObserver`, load the **[`IntersectionObserver` polyfill](https://github.com/w3c/IntersectionObserver/tree/master/polyfill).**

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