Skip to content

Commit

Permalink
Hotfix to fix whatInput.set not working
Browse files Browse the repository at this point in the history
  • Loading branch information
ten1seven committed Feb 19, 2016
1 parent e1618b8 commit 78e50dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "what-input",
"version": "1.2.2",
"version": "1.2.3",
"homepage": "https://github.com/ten1seven/what-input",
"authors": [
"Jeremy Fields <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "what-input",
"version": "1.2.2",
"version": "1.2.3",
"description": "A global utility for tracking the current input method (mouse, keyboard or touch).",
"main": "what-input.js",
"repository": {
Expand Down
14 changes: 9 additions & 5 deletions what-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,20 @@
) {
// ignore keyboard typing on form elements
} else {
currentInput = value;
body.setAttribute('data-whatinput', currentInput);

if (inputTypes.indexOf(currentInput) === -1) inputTypes.push(currentInput);
switchInput(value);
}
}

if (value === 'keyboard') logKeys(eventKey);
}

function switchInput(string) {
currentInput = string;
body.setAttribute('data-whatinput', currentInput);

if (inputTypes.indexOf(currentInput) === -1) inputTypes.push(currentInput);
}

function key(event) {
return (event.keyCode) ? event.keyCode : event.which;
}
Expand Down Expand Up @@ -261,7 +265,7 @@
types: function() { return inputTypes; },

// accepts string: manually set the input type
set: setInput
set: switchInput
};

}));
4 changes: 2 additions & 2 deletions what-input.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78e50dc

Please sign in to comment.