intersection-events
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,22 +0,8 @@ | ||
const pkg = require('./package.json') | ||
const banner = require('banner-package') | ||
const banner = `/*! | ||
* ${pkg.name} v${pkg.version} | ||
* ${pkg.homepage} | ||
* | ||
* @license | ||
* Copyright (c) 2018 ${pkg.author} | ||
* Released under the MIT license | ||
*/` | ||
const otherBanner = ` | ||
/*! npm.im/noop-es2015 */ | ||
/*! npm.im/get-elements-array */` | ||
module.exports = { | ||
format: ['es', 'iife', 'iife-min'], | ||
moduleName: 'IntersectionEvents', | ||
banner: banner + otherBanner, | ||
banner, | ||
js: 'buble', | ||
map: false | ||
} |
@@ -5,8 +5,9 @@ /*! | ||
* | ||
* @license | ||
* Copyright (c) 2018 Ko.Yelie | ||
* Released under the MIT license | ||
* (c) 2018-present Ko.Yelie | ||
* Released under the MIT License. | ||
* | ||
* Dependencies | ||
* https://www.npmjs.com/package/get-elements-array | ||
* https://www.npmjs.com/package/noop-es2015 | ||
*/ | ||
/*! npm.im/noop-es2015 */ | ||
/*! npm.im/get-elements-array */ | ||
import noop from 'noop-es2015'; | ||
@@ -13,0 +14,0 @@ import getElements from 'get-elements-array'; |
@@ -5,8 +5,9 @@ /*! | ||
* | ||
* @license | ||
* Copyright (c) 2018 Ko.Yelie | ||
* Released under the MIT license | ||
* (c) 2018-present Ko.Yelie | ||
* Released under the MIT License. | ||
* | ||
* Dependencies | ||
* https://www.npmjs.com/package/get-elements-array | ||
* https://www.npmjs.com/package/noop-es2015 | ||
*/ | ||
/*! npm.im/noop-es2015 */ | ||
/*! npm.im/get-elements-array */ | ||
var IntersectionEvents = (function () { | ||
@@ -13,0 +14,0 @@ 'use strict'; |
@@ -5,8 +5,9 @@ /*! | ||
* | ||
* @license | ||
* Copyright (c) 2018 Ko.Yelie | ||
* Released under the MIT license | ||
* (c) 2018-present Ko.Yelie | ||
* Released under the MIT License. | ||
* | ||
* Dependencies | ||
* https://www.npmjs.com/package/get-elements-array | ||
* https://www.npmjs.com/package/noop-es2015 | ||
*/ | ||
/*! npm.im/noop-es2015 */ | ||
/*! npm.im/get-elements-array */ | ||
var IntersectionEvents=function(){"use strict";function n(){}return function(t,e){void 0===e&&(e={});var r=e.onEnter,i=e.onLeave;void 0===i&&(i=n);var o=e.enterThreshold;void 0===o&&(o=.99);var s,a,c=e.leaveThreshold;void 0===c&&(c=0),1===o&&(o=.99),1===c&&(c=.99),o===c?(s=function(n){return n.isIntersecting},a=function(n){return 0===c?!n.isIntersecting:n.isIntersecting}):(s=function(n){return Math.abs(n.intersectionRatio-o)<=Math.abs(n.intersectionRatio-c)},a=function(n){return Math.abs(n.intersectionRatio-o)>=Math.abs(n.intersectionRatio-c)});var u,v=function(n){n.forEach(function(n){var t=n.target;!t.isEnter&&s(n)?(t.isEnter=!0,r()):t.isEnter&&a(n)&&(t.isEnter=!1,i())})},h=new IntersectionObserver(v,{threshold:[c,o]});(u=t,u?("string"==typeof u&&(u=document.querySelectorAll(u)),"length"in u&&u.nodeType!==Node.ELEMENT_NODE&&!function(n){return n.location&&n.document&&n.alert&&n.setInterval}(u)?Array.apply(null,u):[u]):[]).forEach(function(n){n.isEnter=!1;var t=window.innerHeight/n.offsetHeight,e=o>t,r=c>t,i=h;(e||r)&&(i=new IntersectionObserver(v,{threshold:[r?c*t:c,e?o*t:o]})),i.observe(n)})}}(); |
{ | ||
"name": "intersection-events", | ||
"version": "0.0.1", | ||
"moduleName": "IntersectionEvents", | ||
"version": "0.0.2", | ||
"description": "Wrapper of IntersectionObserver", | ||
@@ -15,6 +16,8 @@ "main": "dist/intersection-events.es.js", | ||
"keywords": [ | ||
"example" | ||
"IntersectionObserver", | ||
"scroll" | ||
], | ||
"author": "Ko.Yelie", | ||
"license": "MIT", | ||
"year": 2018, | ||
"bugs": { | ||
@@ -25,2 +28,3 @@ "url": "https://github.com/ko-yelie/intersection-events/issues" | ||
"devDependencies": { | ||
"banner-package": "0.0.2", | ||
"bili": "^3.0.15" | ||
@@ -27,0 +31,0 @@ }, |
13709
2
292