Prefer const/let over var

This commit is contained in:
Juanjo Diaz
2018-05-24 00:27:09 +03:00
parent cdb860ad84
commit 2b5f94fa6a
42 changed files with 1091 additions and 1131 deletions

View File

@@ -24,7 +24,7 @@ export function getKeycode(evt){
// in the 'keyCode' field for non-printable characters. However
// Webkit sets it to the same as charCode in 'keypress' events.
if ((evt.type !== 'keypress') && (evt.keyCode in vkeys)) {
var code = vkeys[evt.keyCode];
let code = vkeys[evt.keyCode];
// macOS has messed up this code for some reason
if (browser.isMac() && (code === 'ContextMenu')) {
@@ -110,7 +110,7 @@ export function getKey(evt) {
}
// Try to deduce it based on the physical key
var code = getKeycode(evt);
const code = getKeycode(evt);
if (code in fixedkeys) {
return fixedkeys[code];
}
@@ -126,7 +126,7 @@ export function getKey(evt) {
// Get the most reliable keysym value we can get from a key event
export function getKeysym(evt){
var key = getKey(evt);
const key = getKey(evt);
if (key === 'Unidentified') {
return null;
@@ -134,7 +134,7 @@ export function getKeysym(evt){
// First look up special keys
if (key in DOMKeyTable) {
var location = evt.location;
let location = evt.location;
// Safari screws up location for the right cmd key
if ((key === 'Meta') && (location === 0)) {
@@ -150,14 +150,12 @@ export function getKeysym(evt){
// Now we need to look at the Unicode symbol instead
var codepoint;
// Special key? (FIXME: Should have been caught earlier)
if (key.length !== 1) {
return null;
}
codepoint = key.charCodeAt();
const codepoint = key.charCodeAt();
if (codepoint) {
return keysyms.lookup(codepoint);
}