diff --git a/bower.json b/bower.json index 996048f..00dd1df 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "what-input", - "version": "4.3.0", + "version": "4.3.1", "homepage": "https://github.com/ten1seven/what-input", "repository": { "url": "https://github.com/ten1seven/what-input.git", diff --git a/dist/what-input.js b/dist/what-input.js index 40b40af..2d5c8f2 100644 --- a/dist/what-input.js +++ b/dist/what-input.js @@ -1,6 +1,6 @@ /** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). - * @version v4.3.0 + * @version v4.3.1 * @link https://github.com/ten1seven/what-input * @license MIT */ @@ -58,7 +58,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ (function(module, exports) { +/***/ function(module, exports) { 'use strict'; @@ -161,6 +161,7 @@ return /******/ (function(modules) { // webpackBootstrap // `pointermove`, `MSPointerMove`, `mousemove` and mouse wheel event binding // can only demonstrate potential, but not actual, interaction // and are treated separately + var options = supportsPassive ? { passive: true } : false; // pointer events (mouse, pen, touch) if (window.PointerEvent) { @@ -176,13 +177,13 @@ return /******/ (function(modules) { // webpackBootstrap // touch events if ('ontouchstart' in window) { - doc.addEventListener('touchstart', touchBuffer); + doc.addEventListener('touchstart', touchBuffer, options); doc.addEventListener('touchend', touchBuffer); } } // mouse wheel - doc.addEventListener(detectWheel(), setIntent, supportsPassive ? { passive: true } : false); + doc.addEventListener(detectWheel(), setIntent, options); // keyboard events doc.addEventListener('keydown', updateInput); @@ -373,7 +374,7 @@ return /******/ (function(modules) { // webpackBootstrap }; }(); -/***/ }) +/***/ } /******/ ]) }); ; \ No newline at end of file diff --git a/dist/what-input.min.js b/dist/what-input.min.js index 70c4678..e3e1ef2 100644 --- a/dist/what-input.min.js +++ b/dist/what-input.min.js @@ -1,7 +1,7 @@ /** * what-input - A global utility for tracking the current input method (mouse, keyboard or touch). - * @version v4.3.0 + * @version v4.3.1 * @link https://github.com/ten1seven/what-input * @license MIT */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("whatInput",[],t):"object"==typeof exports?exports.whatInput=t():e.whatInput=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){"use strict";e.exports=function(){var e="initial",t=null,n=document.documentElement,o=["input","select","textarea"],i=[],r=[16,17,18,91,93],u=[9],d={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"},s=[],a=!1,p=!1,c={x:null,y:null},f={2:"touch",3:"touch",4:"mouse"},v=!1;try{var l=Object.defineProperty({},"passive",{get:function(){v=!0}});window.addEventListener("test",null,l)}catch(e){}var h=function(){window.PointerEvent?(n.addEventListener("pointerdown",m),n.addEventListener("pointermove",y)):window.MSPointerEvent?(n.addEventListener("MSPointerDown",m),n.addEventListener("MSPointerMove",y)):(n.addEventListener("mousedown",m),n.addEventListener("mousemove",y),"ontouchstart"in window&&(n.addEventListener("touchstart",x),n.addEventListener("touchend",x))),n.addEventListener(b(),y,!!v&&{passive:!0}),n.addEventListener("keydown",m),n.addEventListener("keyup",m)},m=function(n){if(!a){var i=n.which,s=d[n.type];if("pointer"===s&&(s=L(n)),e!==s||t!==s){var p=document.activeElement,c=!1;(p&&p.nodeName&&-1===o.indexOf(p.nodeName.toLowerCase())||-1!==u.indexOf(i))&&(c=!0),("touch"===s||"mouse"===s||"keyboard"===s&&i&&c&&-1===r.indexOf(i))&&(e=t=s,w())}}},w=function(){n.setAttribute("data-whatinput",e),n.setAttribute("data-whatintent",e),-1===s.indexOf(e)&&(s.push(e),n.className+=" whatinput-types-"+e),E("input")},y=function(e){if(c.x!==e.screenX||c.y!==e.screenY?(p=!1,c.x=e.screenX,c.y=e.screenY):p=!0,!a&&!p){var o=d[e.type];"pointer"===o&&(o=L(e)),t!==o&&(t=o,n.setAttribute("data-whatintent",t),E("intent"))}},x=function(e){"touchstart"===e.type?(a=!1,m(e)):a=!0},E=function(e){for(var n=0,o=i.length;n