keyboard.js 339 B

1234567891011121314151617
  1. import EventSystem from './EventSystem';
  2. export default class Keyboard extends EventSystem{
  3. constructor(){
  4. super()
  5. this.keys = {};
  6. window.addEventListener('onkeypress', (e) => this.press(pliktro) )
  7. }
  8. listen() {
  9. window.addEventListener('keydown',(e) => {
  10. //TODO add functionality
  11. this.emit(e.key)
  12. })
  13. return this;
  14. }
  15. }