module:KeyboardEvent

module:KeyboardEvent

Keyboard event class

Constructor

# new module:KeyboardEvent(name, target, eventopt)

MouseEvent constructor

Parameters:
Name Type Attributes Description
name String

Name of the event

target EventEmitter

Component concerned by the event

event UIEvent <optional>

Original HTML event For the complete list of key values: https://developer.mozilla.org/en/docs/Web/API/KeyboardEvent/key/Key_Values

Extends

Members

# (static) events :KeyboardEvents

Set of supported event name for easy access

Type:
  • KeyboardEvents
Example
component.on(KeyboardEvent.events.up, () => console.log("User release a key"));

# (static) keys :KeyboardKeys

Set of keys for easy access

Type:
  • KeyboardKeys
Example
if (key === KeyboardEvent.keys.enter) {
    console.log("This is the enter key");
}

Type Definitions

# ArrowKeys

Type:
  • Object
Properties
Name Type Description
up String

Up arrow

right String

Right arrow

down String

Down arrow

left String

Left arrow

# KeyboardEvents

Type:
  • Object
Properties
Name Type Description
down String

Keyboard key pressed

up String

Keyboard key released

# KeyboardKeys

Type:
  • Object
Properties
Name Type Description
backspace String

Remove last character or return previous screen

enter String

Add line-break or validate entry

delete String

Remove character in front

escape String

Cancel or leave screen

control String

Modifying key (control)

shift String

Modifying key (uppercase)

fn String

Modifying key (function)

ArrowKeys
tab String

Next input or toggle focus

alt String

Modifying key (alternative)

altGr String

Modifying key (alternative grapheme)

pageUp String

Move up one page

pageDown String

Move down one page

start String

Go to start

end String

Go to end

insert String

Insert here or toggle insert mode