From 8ca77c360f1fe365811f0f6776bc9fe67ce517d6 Mon Sep 17 00:00:00 2001 From: SthephanShi Date: Fri, 3 Dec 2021 23:34:41 +0200 Subject: [PATCH] Fix keyCodes (#17) --- bytebeat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bytebeat.js b/bytebeat.js index 4b887c71..be35e777 100644 --- a/bytebeat.js +++ b/bytebeat.js @@ -184,7 +184,7 @@ const bytebeat = new class { this.controlVolume = document.getElementById('control-volume'); this.timeCursor = document.getElementById('canvas-timecursor'); this.controlCounter.oninput = this.controlCounter.onkeydown = e => { - if(e.keyCode === 13 /* ENTER */) { + if(e.key === 'Enter') { this.controlCounter.blur(); this.togglePlay(true); return; @@ -200,7 +200,7 @@ const bytebeat = new class { this.editorElem = document.getElementById('editor'); this.editorElem.oninput = () => this.setFunction(); this.editorElem.onkeydown = e => { - if(e.keyCode === 9 /* TAB */ && !e.shiftKey && !e.altKey && !e.ctrlKey) { + if(e.key === 'Tab' && !e.shiftKey && !e.altKey && !e.ctrlKey) { e.preventDefault(); const el = e.target; const { value, selectionStart } = el;