this post was submitted on 10 Jun 2024
17 points (94.7% liked)
Firefox
17902 readers
25 users here now
A place to discuss the news and latest developments on the open-source browser Firefox
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
To detect two keystrokes closely followed, you can use
EventListener
s for theonkeyup
/onkeydown
event. In combination with a variable that determines if the key was already pressed within the last 100 ms and asetTimeout
call that resets that variable after 100 ms, it should be fairly easy to accomplish.