Tracks which keys are currently pressed
Try and guess the password 👀
With an instance of PressedKeys, you can use the has method.
PressedKeys
has
const keys = new PressedKeys(); const isArrowDownPressed = $derived(keys.has("ArrowDown")); const isCtrlAPressed = $derived(keys.has("Control", "a"));
Or get all of the currently pressed keys:
const keys = new PressedKeys(); console.log(keys.all());