Only execute "toLowerCase" once

This commit is contained in:
Manuel Vögele
2021-08-02 15:47:10 +02:00
parent 59c12d017b
commit f1a153a2eb
+5 -3
View File
@@ -114,9 +114,11 @@ function handleKeys(event, key, up) {
if (event.repeat || this.hasFocus) if (event.repeat || this.hasFocus)
return false return false
if (key.toLowerCase() === "x") return onKeyX(up) const lowercaseKey = key.toLowerCase();
if (key.toLowerCase() === "shift") return onKeyShift(up)
if (key.toLowerCase() === "space") return onKeySpace(up); if (lowercaseKey === "x") return onKeyX(up)
if (lowercaseKey === "shift") return onKeyShift(up)
if (lowercaseKey === "space") return onKeySpace(up);
return false return false
} }