touchsweep
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -1,1 +0,2 @@ | ||
(function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={exports:{}};b(c.exports),a.touchsweep=c.exports}})(this,function(a){"use strict";function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var e=function(){function a(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.body,d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:40;return b(this,a),this.element=c,this.eventData=d,this.threshold=e,this.coords={startX:0,startY:0,endX:0,endY:0},this.onStart=this.onStart.bind(this),this.onEnd=this.onEnd.bind(this),this.bind(),this}return d(a,[{key:"onStart",value:function b(a){this.coords.startX=a.changedTouches[0].screenX,this.coords.startY=a.changedTouches[0].screenY}},{key:"onEnd",value:function b(a){this.coords.endX=a.changedTouches[0].screenX,this.coords.endY=a.changedTouches[0].screenY,this.dispatch()}},{key:"bind",value:function a(){this.element.addEventListener("touchstart",this.onStart,!1),this.element.addEventListener("touchend",this.onEnd,!1)}},{key:"unbind",value:function a(){this.element.removeEventListener("touchstart",this.onStart,!1),this.element.removeEventListener("touchend",this.onEnd,!1)}},{key:"getEventName",value:function h(){var a=Math.abs,b=this.threshold,c=this.coords,d=c.startX,e=c.startY,f=c.endX,g=c.endY;return f<d&&a(g-e)<b?"swipeleft":f>d&&a(f-d)>b?"swiperight":g<e&&a(f-d)<b?"swipeup":g>e&&a(g-e)>b?"swipedown":g===e&&f===d?"tap":""}},{key:"dispatch",value:function c(){var a=this.getEventName();if(a){var b=new CustomEvent(a,{detail:this.eventData});this.element.dispatchEvent(b)}}}]),a}();a.default=e}); | ||
(function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={exports:{}};b(c.exports),a.touchsweep=c.exports}})(this,function(a){"use strict";function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var e=/*#__PURE__*/function(){function a(){var c=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.body,d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:40;return b(this,a),this.element=c,this.eventData=d,this.threshold=e,this.coords={startX:0,startY:0,endX:0,endY:0},this.onStart=this.onStart.bind(this),this.onEnd=this.onEnd.bind(this),this.bind(),this}return d(a,[{key:"onStart",value:function b(a){this.coords.startX=a.changedTouches[0].screenX,this.coords.startY=a.changedTouches[0].screenY}},{key:"onEnd",value:function b(a){this.coords.endX=a.changedTouches[0].screenX,this.coords.endY=a.changedTouches[0].screenY,this.dispatch()}},{key:"bind",value:function a(){this.element.addEventListener("touchstart",this.onStart,!1),this.element.addEventListener("touchend",this.onEnd,!1)}},{key:"unbind",value:function a(){this.element.removeEventListener("touchstart",this.onStart,!1),this.element.removeEventListener("touchend",this.onEnd,!1)}},{key:"getEventName",value:function h(){var a=Math.abs,b=this.threshold,c=this.coords,d=c.startX,e=c.startY,f=c.endX,g=c.endY;return f<d&&a(g-e)<b?"swipeleft":f>d&&a(f-d)>b?"swiperight":g<e&&a(f-d)<b?"swipeup":g>e&&a(g-e)>b?"swipedown":g===e&&f===d?"tap":""}},{key:"dispatch",value:function c(){var a=this.getEventName();if(a){// TODO: Check browser support | ||
var b=new CustomEvent(a,{detail:this.eventData});this.element.dispatchEvent(b)}}}]),a}();a.default=e}); |
{ | ||
"name": "touchsweep", | ||
"version": "0.2.0", | ||
"description": "Super tiny vanilla JS module to detect swipe direction", | ||
"keywords": [ | ||
"Touch", | ||
"Event", | ||
"Touch Events", | ||
"touchstart", | ||
"touchend", | ||
"touchmove", | ||
"swipe" | ||
], | ||
"main": "dist/touchsweep.js", | ||
"scripts": { | ||
"dist": "babel src/touchsweep.js --out-file dist/touchsweep.js", | ||
"minify": "babel src/touchsweep.js --out-file dist/touchsweep.min.js --presets minify,@babel/env", | ||
"build": "npm run dist && npm run minify" | ||
}, | ||
"repository": "git@github.com:scriptex/touchsweep.git", | ||
"bugs": { | ||
"url": "https://github.com/scriptex/touchsweep/issues", | ||
"email": "scriptex.bg@gmail.com" | ||
}, | ||
"author": "Atanas Atanasov <scriptex.bg@gmail.com> (https://atanas.info)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0-rc.1", | ||
"@babel/core": "^7.0.0-rc.1", | ||
"@babel/plugin-proposal-class-properties": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-decorators": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-export-namespace-from": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-function-sent": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-json-strings": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-numeric-separator": "7.0.0-rc.1", | ||
"@babel/plugin-proposal-throw-expressions": "7.0.0-rc.1", | ||
"@babel/plugin-syntax-dynamic-import": "7.0.0-rc.1", | ||
"@babel/plugin-syntax-import-meta": "7.0.0-rc.1", | ||
"@babel/plugin-transform-modules-umd": "^7.0.0-rc.1", | ||
"@babel/preset-env": "^7.0.0-rc.1", | ||
"babel-loader": "^8.0.0-beta.0", | ||
"babel-minify": "^0.4.3" | ||
}, | ||
"dependencies": {} | ||
"name": "touchsweep", | ||
"version": "1.0.0", | ||
"description": "Super tiny vanilla JS module to detect swipe direction", | ||
"keywords": [ | ||
"Touch", | ||
"Event", | ||
"Touch Events", | ||
"touchstart", | ||
"touchend", | ||
"touchmove", | ||
"swipe" | ||
], | ||
"main": "dist/touchsweep.js", | ||
"scripts": { | ||
"dist": "babel src/touchsweep.js --out-file dist/touchsweep.js", | ||
"minify": "babel src/touchsweep.js --out-file dist/touchsweep.min.js --presets minify,@babel/env", | ||
"build": "npm run dist && npm run minify" | ||
}, | ||
"repository": "git@github.com:scriptex/touchsweep.git", | ||
"bugs": { | ||
"url": "https://github.com/scriptex/touchsweep/issues", | ||
"email": "scriptex.bg@gmail.com" | ||
}, | ||
"author": "Atanas Atanasov <scriptex.bg@gmail.com> (https://atanas.info)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/cli": "7.2.3", | ||
"@babel/core": "7.2.2", | ||
"@babel/plugin-proposal-class-properties": "7.2.3", | ||
"@babel/plugin-proposal-decorators": "7.2.3", | ||
"@babel/plugin-proposal-export-namespace-from": "7.2.0", | ||
"@babel/plugin-proposal-function-sent": "7.2.0", | ||
"@babel/plugin-proposal-json-strings": "7.2.0", | ||
"@babel/plugin-proposal-numeric-separator": "7.2.0", | ||
"@babel/plugin-proposal-throw-expressions": "7.2.0", | ||
"@babel/plugin-syntax-dynamic-import": "7.2.0", | ||
"@babel/plugin-syntax-import-meta": "7.2.0", | ||
"@babel/plugin-transform-modules-umd": "7.2.0", | ||
"@babel/preset-env": "7.2.3", | ||
"babel-loader": "8.0.4", | ||
"babel-minify": "0.5.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -9,3 +9,2 @@ [![GitHub release](https://img.shields.io/github/release/scriptex/touchsweep.svg)](https://github.com/scriptex/touchsweep/releases/latest) | ||
[![Analytics](https://ga-beacon.appspot.com/UA-83446952-1/github.com/scriptex/touchsweep/README.md)](https://github.com/scriptex/touchsweep/) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/scriptex/touchsweep.svg)](https://greenkeeper.io/) | ||
@@ -12,0 +11,0 @@ # TouchSweep |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
186
1
15409
7
95