aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/static/js/keyboard_handler.js
diff options
context:
space:
mode:
authorGravatar jvoisin <julien.voisin@dustri.org> 2024-03-20 23:59:37 +0100
committerGravatar Frédéric Guillot <f@miniflux.net> 2024-03-20 17:36:01 -0700
commitbeb8c80787beadbfdb8b970368a3200f7d59f58e (patch)
tree1096a698ef89494cc58a5d81be15bc9ca56422d7 /internal/ui/static/js/keyboard_handler.js
parentfc4bdf3ab0088c8110905148951a26412bdef3ec (diff)
downloadv2-beb8c80787beadbfdb8b970368a3200f7d59f58e.tar.gz
v2-beb8c80787beadbfdb8b970368a3200f7d59f58e.tar.zst
v2-beb8c80787beadbfdb8b970368a3200f7d59f58e.zip
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.
Diffstat (limited to 'internal/ui/static/js/keyboard_handler.js')
-rw-r--r--internal/ui/static/js/keyboard_handler.js8
1 files changed, 4 insertions, 4 deletions
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];
}