From beb8c80787beadbfdb8b970368a3200f7d59f58e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 20 Mar 2024 23:59:37 +0100 Subject: Replace a bunch of `let` with `const` According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const > Many style guides (including MDN's) recommend using const over let whenever a variable is not reassigned in its scope. This makes the intent clear that a variable's type (or value, in the case of a primitive) can never change. --- internal/ui/static/js/keyboard_handler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/ui/static/js/keyboard_handler.js') diff --git a/internal/ui/static/js/keyboard_handler.js b/internal/ui/static/js/keyboard_handler.js index 863309d9..eb5b0548 100644 --- a/internal/ui/static/js/keyboard_handler.js +++ b/internal/ui/static/js/keyboard_handler.js @@ -12,7 +12,7 @@ class KeyboardHandler { listen() { document.onkeydown = (event) => { - let key = this.getKey(event); + const key = this.getKey(event); if (this.isEventIgnored(event, key) || this.isModifierKeyDown(event)) { return; } @@ -23,8 +23,8 @@ class KeyboardHandler { this.queue.push(key); - for (let combination in this.shortcuts) { - let keys = combination.split(" "); + for (const combination in this.shortcuts) { + const keys = combination.split(" "); if (keys.every((value, index) => value === this.queue[index])) { this.queue = []; @@ -64,7 +64,7 @@ class KeyboardHandler { 'Right': 'ArrowRight' }; - for (let key in mapping) { + for (const key in mapping) { if (mapping.hasOwnProperty(key) && key === event.key) { return mapping[key]; } -- cgit v1.2.3