@laserware/keytar

Enumerations

Key

Numbers that correspond to the key codes of the keyboard. Note that these are not the same as the character codes and don't support international keyboards.

Modifier

Keyboard modifier keys (e.g. Shift, Alt, etc.).

MouseButton

Represents mouse buttons that could be pressed. These do not match the mouse buttons from the MouseEvent (which are much lower). This is so we can check for a combination of keyboard modifiers and mouse buttons (e.g. Shift + Left Click).

Interfaces

ChordHandler

Object with handlers that get fired based on the conditional checks.

Type Aliases

Chord

A single Token or a combination of Tokens which are joined via a bitwise OR (|) operator.

ChordedEvent

An event from which a combination of Token elements can be extracted.

ChordHandlerBuilder

Builder function for a ChordHandler.

ChordInput

Input for chords, can be a single chord combination or an array of chord combinations.

ChordMatchListener

Listener fired when a matching chord is found.

Token

A Key, Modifier, or MouseButton. This represents a single element in a chord.

WhenCondition

Condition passed to ChordHandler.when.

Functions

getChordDisplay

Gets the display value for the specified chord. If the chord is a combination of multiple keys/buttons, the display value for each key/button is joined with the specified joinSymbol.

handleChords

Fires the specified listener if the specified combination of chords were pressed/clicked from the specified event.

isChordPressed

Checks if one of the specified chords combinations were pressed based on the specified keyboard or mouse event.

isPrintableChar

Checks if the specified key represents a printable character.

isPrintableCharPressed

Checks if a printable character key was pressed (excluding any modifiers).