From b7c2ba22a4267326f1d37d9d3872fdfce6e7be22 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Thu, 17 Nov 2022 08:30:04 -0600 Subject: [PATCH] keydown repeat --- server/scripts/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/scripts/index.js b/server/scripts/index.js index 5a42116..a7d44a0 100644 --- a/server/scripts/index.js +++ b/server/scripts/index.js @@ -354,6 +354,10 @@ const index = (() => { const documentKeydown = (e) => { const code = (e.keyCode || e.which); + // 200ms repeat + if ((Date.now() - documentKeydown.lastButton ?? 0) < 200) return false; + documentKeydown.lastButton = Date.now(); + if (document.fullscreenElement || document.activeElement === document.body) { switch (code) { case 32: // Space