Merge pull request #8 from weiserhei/patch-3

add argument `event` to onKeyChange function calls
This commit is contained in:
Paul Graffam 2018-05-13 20:49:30 -04:00 committed by GitHub
commit 7a86dd1991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -14,16 +14,16 @@ export default class Keyboard {
this.keyCodes = {}; this.keyCodes = {};
// bind keyEvents // bind keyEvents
this.domElement.addEventListener('keydown', () => this.onKeyChange(event), false); this.domElement.addEventListener('keydown', (event) => this.onKeyChange(event), false);
this.domElement.addEventListener('keyup', () => this.onKeyChange(event), false); this.domElement.addEventListener('keyup', (event) => this.onKeyChange(event), false);
// bind window blur // bind window blur
window.addEventListener('blur', () => this.onBlur, false); window.addEventListener('blur', () => this.onBlur, false);
} }
destroy() { destroy() {
this.domElement.removeEventListener('keydown', () => this.onKeyChange(event), false); this.domElement.removeEventListener('keydown', (event) => this.onKeyChange(event), false);
this.domElement.removeEventListener('keyup', () => this.onKeyChange(event), false); this.domElement.removeEventListener('keyup', (event) => this.onKeyChange(event), false);
// unbind window blur event // unbind window blur event
window.removeEventListener('blur', () => this.onBlur, false); window.removeEventListener('blur', () => this.onBlur, false);