KeyListener

A simple class for registering keyup/keydown events and identifying if a key is currently being pressed.

Constructor

KeyListener(domElement)

domElement: The HTML element to add event listeners to.

Properties

.isKeyDown : Object

An object whose keys are key codes from the Keys dictionary and values are boolean flags indicating if the corresponding key is currently being pressed.

.onKeyDown : Function

A callback triggered after the "keydown" event. Receives the "event" object as a parameter.

.onKeyUp : Function

A callback triggered after the "keyup" event. Receives the "event" object as a parameter.

Methods

.dispose () : null

Remove all the event listeners.

Source

For more info on how to obtain the source code of this module see this page.