minor
This commit is contained in:
parent
5d1037cbd0
commit
9bfd54a148
2 changed files with 22 additions and 19 deletions
|
@ -1,6 +1,6 @@
|
|||
|
||||
We should use two handlers: `document.onkeydown` and `document.onkeyup`.
|
||||
|
||||
The set `pressed` should keep currently pressed keys.
|
||||
Let's create a set `pressed = new Set()` to keep currently pressed keys.
|
||||
|
||||
The first handler adds to it, while the second one removes from it. Every time on `keydown` we check if we have enough keys pressed, and run the function if it is so.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue