KeyboardClass
KeyboardClass class provides methods to emulate keyboard input
class KeyboardClass extends TypedEventEmitter<KeyboardInputEvents, this>Properties
| Name | Type | Description |
|---|---|---|
config | KeyboardConfig | Config object for KeyboardClass class(default: ...) |
Methods
pressKey
pressKey(keys: Key[]): Promise<KeyboardClass>pressKey presses a single Key or Key combinations
Modifier Keys are to be given in "natural" ordering, so first modifier Keys, followed by the Key to press
**ATTENTION**: There's a difference how regular keys are handled vs. modifier keys.
Modifier keys will be held until released via releaseKey is called.
This means that a modifier key is applied to all subsequent regular key inputs until it is released.
Regular keys, on the other hand, are not held until released, so there's no automatic key repeat.
If you want to have something like key repeat, please use setInterval instead.
Parameters
Returns
Promise<KeyboardClass>releaseKey
releaseKey(keys: Key[]): Promise<KeyboardClass>pressKey releases a single Key or Key combinations
Modifier Keys are to be given in "natural" ordering, so first modifier Keys, followed by the Key to release
**ATTENTION**: There's a difference how regular keys are handled vs. modifier keys.
Modifier keys will be held until released via releaseKey is called.
This means that, in contrast to regular keys, a modifier key has to be explicitly released
Parameters
Returns
Promise<KeyboardClass>type
type(input: StringOrKey): Promise<KeyboardClass>type types a sequence of String or single Keys via system keyboard
Parameters
inputStringOrKeySequence of String or Key to typeReturns
Promise<KeyboardClass>Was this page helpful?