mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
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.
This commit is contained in:
parent
fc4bdf3ab0
commit
beb8c80787
6 changed files with 41 additions and 44 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue