ES6 initial setup

This commit is contained in:
Francisco Hodge
2018-04-20 16:34:02 -04:00
commit df42db3b95
35 changed files with 14071 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import Keyboard from '../lib';
import './App.css';
class App {
constructor(){
document.addEventListener('DOMContentLoaded', this.onDOMLoaded);
this.layoutName = "default";
}
onDOMLoaded = () => {
this.keyboard = new Keyboard({
debug: true,
layoutName: this.layoutName,
onChange: input => this.onChange(input),
onKeyPress: button => this.onKeyPress(button)
});
this.keyboard.setInput("Hello World!");
console.log(this.keyboard);
}
handleShiftButton = () => {
let layoutName = this.layoutName;
let shiftToggle = this.layoutName = layoutName === "default" ? "shift" : "default";
this.keyboard.setOptions({
layoutName: shiftToggle
});
}
onChange = input => {
document.querySelector('.input').value = input;
}
onKeyPress = button => {
console.log("Button pressed", button);
/**
* Shift functionality
*/
if(button === "{lock}" || button === "{shift}")
this.handleShiftButton();
}
}
export default App;