swipelistener-js
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,0 +0,0 @@ var defaultConfig = { |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Popup=e()}(this,function(){"use strict";function o(e,t){var n,o=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)),o}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o,r,i=[],a=!0,c=!1;try{for(n=n.call(t);!(a=(o=n.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){c=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(c)throw r}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var s={moveCallbacks:!1,resistance:0};return function(){function n(){var r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),a(this,"handleTouchStart",function(t){var e=c(t.touches,1)[0];r.xDown=e.clientX,r.yDown=e.clientY,r.swipeEvent.touchStart=t}),a(this,"handleTouchMove",function(t){var e,n,o;r.xDown&&r.yDown&&(e=(r.swipeEvent.touchMove=t).touches[0].clientX,n=t.touches[0].clientY,o=r.xDown-e,t=r.yDown-n,Math.abs(o)>Math.abs(t)?o>r.options.resistance?r.chooseEventCallback("moveleft","swipeleft"):o<-1*r.options.resistance&&r.chooseEventCallback("moveright","swiperight"):t>r.options.resistance?r.chooseEventCallback("moveup","swipeup"):t<-1*r.options.resistance&&r.chooseEventCallback("movedown","swipedown"),r.options.moveCallbacks&&(r.xDown=e,r.yDown=n))}),a(this,"handleTouchEnd",function(t){r.swipeEvent.touchEnd=t,r.triggerCallback(r.event),r.xDown=null,r.yDown=null}),this.options=i(i({},s),e),this.target=t,this.callbacks=[],this.swipeEvent={},this.event="",this.xDown=null,this.yDown=null}var t,e,o;return t=n,(e=[{key:"hasCallback",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";return!!this.callbacks.find(function(t){return t.event===e})}},{key:"init",value:function(){this.addListeners()}},{key:"destroy",value:function(){this.removeListeners(),this.callbacks=[]}},{key:"addListeners",value:function(){this.target.addEventListener("touchstart",this.handleTouchStart),this.target.addEventListener("touchmove",this.handleTouchMove),this.target.addEventListener("touchend",this.handleTouchEnd)}},{key:"removeListeners",value:function(){this.target.removeEventListener("touchstart",this.handleTouchStart),this.target.removeEventListener("touchmove",this.handleTouchMove),this.target.removeEventListener("touchend",this.handleTouchEnd)}},{key:"chooseEventCallback",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";this.options.moveCallbacks&&this.hasCallback(e)?(this.event=e,this.triggerCallback(e),setTimeout(function(){t.event=n})):this.event=n}},{key:"triggerCallback",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";this.callbacks.filter(function(t){return t.event===e}).forEach(function(t){return(0,t.callback)()}),setTimeout(function(){t.event=""})}},{key:"on",value:function(){return this.callbacks.push({event:0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",callback:1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){}}),this}},{key:"off",value:function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(){};this.callbacks=this.callbacks.filter(function(t){var e=t.callback,t=t.event;return!(o===e&&n===t)})}}])&&r(t.prototype,e),o&&r(t,o),n}()}); |
@@ -0,0 +0,0 @@ 'use strict'; |
{ | ||
"name": "swipelistener-js", | ||
"description": "Small JS plugin to handle swipe gestures.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "ghpages": "git subtree push --prefix build origin gh-pages", |
@@ -10,7 +10,7 @@ # swipelistener-js | ||
```bash | ||
$ yarn add swipelistener | ||
$ yarn add swipelistener-js | ||
``` | ||
```js | ||
import Swipe from './main' | ||
import Swipe from 'swipelistener-js/src/main' | ||
@@ -17,0 +17,0 @@ const swipe = new Swipe(el, options) |
@@ -0,0 +0,0 @@ import babel from '@rollup/plugin-babel' |
@@ -0,0 +0,0 @@ export default { |
@@ -0,0 +0,0 @@ import defaultConfig from './defaultConfig' |
@@ -0,0 +0,0 @@ import Swipe from './main' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27090
0