From 809d89c31ca74a534c83acaad30302ba722514e6 Mon Sep 17 00:00:00 2001 From: Jeremy Fields Date: Tue, 21 Jun 2016 17:16:11 -0600 Subject: [PATCH] Version bump to 3.0.0! --- README.md | 10 ++++++---- bower.json | 2 +- dist/what-input.js | 13 ++++--------- dist/what-input.min.js | 4 ++-- package.json | 2 +- src/what-input.js | 5 ----- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 7ce79d8..bfa9fda 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # What Input? -## What Input is now v2 +## What Input is now v3 -Because of the ever-shifing complexity of supporting module loaders, __What Input__ v2 no longer supports UMD module loading (e.g., `var WhatInput = require('what-input')`). You can still require What Input without assigning a variable (e.g., `require('what-input')`). - -If you need UMD module loading, check out the last [v1.x.x](https://github.com/ten1seven/what-input/releases/tag/v1.2.5) release or [open a ticket](https://github.com/ten1seven/what-input/issues) so I can assess demand. +UMD is back thanks to [mAAdhaTTah](https://github.com/mAAdhaTTah)! ## About What Input @@ -58,6 +56,10 @@ Or require with a script loader. ```javascript require('what-input'); + +// or + +var whatInput = require('what-input'); ``` What Input will start doing its thing while you do yours. diff --git a/bower.json b/bower.json index 36c35a7..085c56d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "what-input", - "version": "2.1.1", + "version": "3.0.0", "homepage": "https://github.com/ten1seven/what-input", "authors": [ "Jeremy Fields " diff --git a/dist/what-input.js b/dist/what-input.js index 2a1bb86..37633f0 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 v2.1.0 + * @version v3.0.0 * @link https://github.com/ten1seven/what-input * @license MIT */ @@ -154,7 +154,7 @@ return /******/ (function(modules) { // webpackBootstrap */ // allows events that are also triggered to be filtered out for `touchstart` - function eventBuffer() { + function eventBuffer(event) { clearTimer(); setInput(event); @@ -168,11 +168,6 @@ return /******/ (function(modules) { // webpackBootstrap if (!buffer) setInput(event); } - function unBufferedEvent(event) { - clearTimer(); - setInput(event); - } - function clearTimer() { window.clearTimeout(timer); } @@ -274,8 +269,8 @@ return /******/ (function(modules) { // webpackBootstrap body.addEventListener(mouseWheel, bufferedEvent); // keyboard events - body.addEventListener('keydown', unBufferedEvent); - body.addEventListener('keyup', unBufferedEvent); + body.addEventListener('keydown', eventBuffer); + body.addEventListener('keyup', eventBuffer); document.addEventListener('keyup', unLogKeys); } diff --git a/dist/what-input.min.js b/dist/what-input.min.js index 0c69c4d..54539de 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 v2.1.0 + * @version v3.0.0 * @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){e.exports=function(){"use strict";function e(){o(),i(event),m=!0,E=window.setTimeout(function(){m=!1},650)}function t(e){m||i(e)}function n(e){o(),i(e)}function o(){window.clearTimeout(E)}function i(e){var t=u(e),n=x[e.type];if("pointer"===n&&(n=d(e)),v!==n){var o=document.activeElement.nodeName.toLowerCase();!f.hasAttribute("data-whatinput-formswitching")&&!f.hasAttribute("data-whatinput-formtyping")&&v&&h.indexOf(o)>-1||l.indexOf(t)>-1||r(n)}"keyboard"===n&&s(t)}function r(e){v=e,f.setAttribute("data-whatinput",v),-1===L.indexOf(v)&&L.push(v)}function u(e){return e.keyCode?e.keyCode:e.which}function d(e){return"number"==typeof e.pointerType?k[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType}function s(e){-1===w.indexOf(b[e])&&b[e]&&w.push(b[e])}function a(e){var t=u(e),n=w.indexOf(b[t]);-1!==n&&w.splice(n,1)}function p(){f=document.body,window.PointerEvent?(f.addEventListener("pointerdown",t),f.addEventListener("pointermove",t)):window.MSPointerEvent?(f.addEventListener("MSPointerDown",t),f.addEventListener("MSPointerMove",t)):(f.addEventListener("mousedown",t),f.addEventListener("mousemove",t),"ontouchstart"in window&&f.addEventListener("touchstart",e)),f.addEventListener(y,t),f.addEventListener("keydown",n),f.addEventListener("keyup",n),document.addEventListener("keyup",a)}function c(){return y="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"}var f,w=[],m=!1,v=null,h=["button","input","select","textarea"],y=c(),l=[16,17,18,91,93],x={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"};x[c()]="mouse";var E,L=[],b={9:"tab",13:"enter",16:"shift",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down"},k={2:"touch",3:"touch",4:"mouse"};return"addEventListener"in window&&Array.prototype.indexOf&&(document.body?p():document.addEventListener("DOMContentLoaded",p)),{ask:function(){return v},keys:function(){return w},types:function(){return L},set:r}}()}])}); \ No newline at end of file +!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){e.exports=function(){"use strict";function e(e){n(),o(e),w=!0,x=window.setTimeout(function(){w=!1},650)}function t(e){w||o(e)}function n(){window.clearTimeout(x)}function o(e){var t=r(e),n=l[e.type];if("pointer"===n&&(n=u(e)),m!==n){var o=document.activeElement.nodeName.toLowerCase();!c.hasAttribute("data-whatinput-formswitching")&&!c.hasAttribute("data-whatinput-formtyping")&&m&&v.indexOf(o)>-1||y.indexOf(t)>-1||i(n)}"keyboard"===n&&d(t)}function i(e){m=e,c.setAttribute("data-whatinput",m),E.indexOf(m)===-1&&E.push(m)}function r(e){return e.keyCode?e.keyCode:e.which}function u(e){return"number"==typeof e.pointerType?b[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType}function d(e){f.indexOf(L[e])===-1&&L[e]&&f.push(L[e])}function s(e){var t=r(e),n=f.indexOf(L[t]);n!==-1&&f.splice(n,1)}function a(){c=document.body,window.PointerEvent?(c.addEventListener("pointerdown",t),c.addEventListener("pointermove",t)):window.MSPointerEvent?(c.addEventListener("MSPointerDown",t),c.addEventListener("MSPointerMove",t)):(c.addEventListener("mousedown",t),c.addEventListener("mousemove",t),"ontouchstart"in window&&c.addEventListener("touchstart",e)),c.addEventListener(h,t),c.addEventListener("keydown",e),c.addEventListener("keyup",e),document.addEventListener("keyup",s)}function p(){return h="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"}var c,f=[],w=!1,m=null,v=["button","input","select","textarea"],h=p(),y=[16,17,18,91,93],l={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch"};l[p()]="mouse";var x,E=[],L={9:"tab",13:"enter",16:"shift",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down"},b={2:"touch",3:"touch",4:"mouse"};return"addEventListener"in window&&Array.prototype.indexOf&&(document.body?a():document.addEventListener("DOMContentLoaded",a)),{ask:function(){return m},keys:function(){return f},types:function(){return E},set:i}}()}])}); \ No newline at end of file diff --git a/package.json b/package.json index 5476d45..e9e4fea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "what-input", - "version": "2.1.1", + "version": "3.0.0", "description": "A global utility for tracking the current input method (mouse, keyboard or touch).", "main": "dist/what-input.js", "repository": { diff --git a/src/what-input.js b/src/what-input.js index 5630d81..1592059 100644 --- a/src/what-input.js +++ b/src/what-input.js @@ -106,11 +106,6 @@ module.exports = (function() { if (!buffer) setInput(event); } - function unBufferedEvent(event) { - clearTimer(); - setInput(event); - } - function clearTimer() { window.clearTimeout(timer); }