five-on-it / apps/client/src/renderer/keyboard / Keyboard
Interface: Keyboard
Defined in: apps/client/src/renderer/keyboard.ts:20
Live keyboard state.
Methods
clear()
clear():
void
Defined in: apps/client/src/renderer/keyboard.ts:28
Forgets every press not yet consumed and every tap not yet sampled (the keys a menu over the game had).
Returns
void
consume()
consume(
code):boolean
Defined in: apps/client/src/renderer/keyboard.ts:24
True once per press of code; consumes one press.
Parameters
code
string
Returns
boolean
dispose()
dispose():
void
Defined in: apps/client/src/renderer/keyboard.ts:32
Removes the listeners.
Returns
void
sample()
sample():
ReadonlySet<string>
Defined in: apps/client/src/renderer/keyboard.ts:22
The codes to treat as held for this tick: held now, or tapped since the last sample.
Returns
ReadonlySet<string>
setTranslate()
setTranslate(
translate):void
Defined in: apps/client/src/renderer/keyboard.ts:30
Takes keys through new bindings from now on (a key's code to the code the game reads, or undefined), forgetting the keys held.
Parameters
translate
(code) => string | undefined
Returns
void
tapGap()
tapGap(
code):number
Defined in: apps/client/src/renderer/keyboard.ts:26
Milliseconds between the last two presses of code (a double tap is a small gap); Infinity before the second press.
Parameters
code
string
Returns
number