Class: Keys

Keys()

A helper to make testing for keypresses and etc easier.

Constructor

new Keys()

constructor
Source:

Methods

hasDelta() → {Boolean}

Check if the keys state has changed since the last update.
Source:
Returns:
True if keystate has changed since last update.
Type
Boolean

isDown(key) → {Boolean}

Check if a key is pressed.
Parameters:
Name Type Description
key String The key to check if is pressed.
Source:
Returns:
isDown If the key is pressed.
Type
Boolean

off(type, key)

Remove the listener for this event for this key.
Parameters:
Name Type Description
type String The type of event listener to remove
key String The key to remove the listener for
Source:

on(type, key, listener)

Set the event listener for a key event.
Parameters:
Name Type Description
type String The type of event to listen for.
key String The key to listen to events for.
listener function The handler called when this event occurs.
Source:

update()

Update the state of the keys. Also triggers listeners based on state if any are set.
Source: