Use fat arrow functions const foo = () => { ... }; for callbacks

and any other function that is passed around and it's not a top level function
This commit is contained in:
Juanjo Diaz
2018-07-09 22:47:29 +02:00
parent 0e4808bf6f
commit 651c23ece3
28 changed files with 177 additions and 191 deletions
+4 -7
View File
@@ -307,7 +307,7 @@ export default class Keyboard {
const target = this._target;
const downList = this._keyDownList;
['AltLeft', 'AltRight'].forEach(function (code) {
['AltLeft', 'AltRight'].forEach((code) => {
if (!(code in downList)) {
return;
}
@@ -338,11 +338,10 @@ export default class Keyboard {
const handler = this._eventHandlers.checkalt;
['mousedown', 'mouseup', 'mousemove', 'wheel',
'touchstart', 'touchend', 'touchmove',
'keydown', 'keyup'].forEach(function (type) {
'keydown', 'keyup'].forEach(type =>
document.addEventListener(type, handler,
{ capture: true,
passive: true });
});
passive: true }));
}
//Log.Debug("<< Keyboard.grab");
@@ -355,9 +354,7 @@ export default class Keyboard {
const handler = this._eventHandlers.checkalt;
['mousedown', 'mouseup', 'mousemove', 'wheel',
'touchstart', 'touchend', 'touchmove',
'keydown', 'keyup'].forEach(function (type) {
document.removeEventListener(type, handler);
});
'keydown', 'keyup'].forEach(type => document.removeEventListener(type, handler));
}
this._target.removeEventListener('keydown', this._eventHandlers.keydown);