Docs update

This commit is contained in:
Francisco Hodge
2018-10-24 18:18:24 -04:00
parent 4589ab789d
commit 2e3ca5716b
63 changed files with 257854 additions and 16 deletions
+17 -1
View File
@@ -1,12 +1,24 @@
/**
* Physical Keyboard Service
*/
class PhysicalKeyboard {
/**
* Creates an instance of the PhysicalKeyboard service
*/
constructor(simpleKeyboardInstance){
/**
* @type {object} A simple-keyboard instance
*/
this.simpleKeyboardInstance = simpleKeyboardInstance;
this.initKeyboardListener();
}
/**
* Initializes key event listeners
*/
initKeyboardListener = () => {
// Normal Keyboard
// Adding button style on keydown
document.addEventListener("keydown", (event) => {
if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){
let buttonPressed = this.getSimpleKeyboardLayoutKey(event);
@@ -38,6 +50,10 @@ class PhysicalKeyboard {
});
}
/**
* Transforms a KeyboardEvent's "key.code" string into a simple-keyboard layout format
* @param {object} event The KeyboardEvent
*/
getSimpleKeyboardLayoutKey = (event) => {
if(this.simpleKeyboardInstance.options.debug){
console.log(event);