Interface: KeyEventsMap

Phaser.Types.Input.Keyboard. KeyEventsMap

Methods


down(key, event)

The Key Down Event.

This event is dispatched by a Key object when it is pressed.

Listen for this event from the Key object instance directly:

var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);

spaceBar.on('down', listener)

You can also create a generic 'global' listener. See Keyboard.Events.ANY_KEY_DOWN for details.

Parameters:
Name Type Description
key Phaser.Input.Keyboard.Key

The Key object that was pressed.

event KeyboardEvent

The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc.

Since: 3.0.0
Source: src/input/keyboard/events/DOWN_EVENT.js (Line 30)

up(key, event)

The Key Up Event.

This event is dispatched by a Key object when it is released.

Listen for this event from the Key object instance directly:

var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);

spaceBar.on('up', listener)

You can also create a generic 'global' listener. See Keyboard.Events.ANY_KEY_UP for details.

Parameters:
Name Type Description
key Phaser.Input.Keyboard.Key

The Key object that was released.

event KeyboardEvent

The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc.

Since: 3.0.0
Source: src/input/keyboard/events/UP_EVENT.js (Line 30)