Class: Key

action.InputState.Key()

Input state associated with a keyboard-type device.

Constructor

new Key()

Source:

Methods

isPressed(key) → {boolean}

Check whether |key| is pressed.

Parameters:
Name Type Description
key string

Normalized key value.

Source:
Returns:

True if |key| is in set of pressed keys.

Type
boolean

press(key) → {boolean}

Add |key| to the set of pressed keys.

Parameters:
Name Type Description
key string

Normalized key value.

Source:
Returns:

True if |key| is in list of pressed keys.

Type
boolean

release(key) → {boolean}

Remove |key| from the set of pressed keys.

Parameters:
Name Type Description
key string

Normalized key value.

Source:
Returns:

True if |key| was present before removal, false otherwise.

Type
boolean

setModState(key, value)

Update modifier state according to |key|.

Parameters:
Name Type Description
key string

Normalized key value of a modifier key.

value boolean

Value to set the modifier attribute to.

Source:
Throws:

If |key| is not a modifier.

Type
InvalidArgumentError