KeyboardEvent
package js.html
Available on js
KeyboardEvent
objects describe a user interaction with the keyboard; each event describes a single interaction between the user and a key (or combination of a key with modifier keys) on the keyboard.
Documentation KeyboardEvent by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Static variables
staticinlineread onlyDOM_KEY_LOCATION_LEFT:Int = 1
staticinlineread onlyDOM_KEY_LOCATION_NUMPAD:Int = 3
staticinlineread onlyDOM_KEY_LOCATION_RIGHT:Int = 2
staticinlineread onlyDOM_KEY_LOCATION_STANDARD:Int = 0
staticinlineread onlyDOM_VK_0:Int = 48
staticinlineread onlyDOM_VK_1:Int = 49
staticinlineread onlyDOM_VK_2:Int = 50
staticinlineread onlyDOM_VK_3:Int = 51
staticinlineread onlyDOM_VK_4:Int = 52
staticinlineread onlyDOM_VK_5:Int = 53
staticinlineread onlyDOM_VK_6:Int = 54
staticinlineread onlyDOM_VK_7:Int = 55
staticinlineread onlyDOM_VK_8:Int = 56
staticinlineread onlyDOM_VK_9:Int = 57
staticinlineread onlyDOM_VK_A:Int = 65
staticinlineread onlyDOM_VK_ACCEPT:Int = 30
staticinlineread onlyDOM_VK_ADD:Int = 107
staticinlineread onlyDOM_VK_ALT:Int = 18
staticinlineread onlyDOM_VK_ALTGR:Int = 225
staticinlineread onlyDOM_VK_AMPERSAND:Int = 166
staticinlineread onlyDOM_VK_ASTERISK:Int = 170
staticinlineread onlyDOM_VK_AT:Int = 64
staticinlineread onlyDOM_VK_ATTN:Int = 246
staticinlineread onlyDOM_VK_B:Int = 66
staticinlineread onlyDOM_VK_BACK_QUOTE:Int = 192
staticinlineread onlyDOM_VK_BACK_SLASH:Int = 220
staticinlineread onlyDOM_VK_BACK_SPACE:Int = 8
staticinlineread onlyDOM_VK_C:Int = 67
staticinlineread onlyDOM_VK_CANCEL:Int = 3
staticinlineread onlyDOM_VK_CAPS_LOCK:Int = 20
staticinlineread onlyDOM_VK_CIRCUMFLEX:Int = 160
staticinlineread onlyDOM_VK_CLEAR:Int = 12
staticinlineread onlyDOM_VK_CLOSE_BRACKET:Int = 221
staticinlineread onlyDOM_VK_CLOSE_CURLY_BRACKET:Int = 175
staticinlineread onlyDOM_VK_CLOSE_PAREN:Int = 169
staticinlineread onlyDOM_VK_COLON:Int = 58
staticinlineread onlyDOM_VK_COMMA:Int = 188
staticinlineread onlyDOM_VK_CONTEXT_MENU:Int = 93
staticinlineread onlyDOM_VK_CONTROL:Int = 17
staticinlineread onlyDOM_VK_CONVERT:Int = 28
staticinlineread onlyDOM_VK_CRSEL:Int = 247
staticinlineread onlyDOM_VK_D:Int = 68
staticinlineread onlyDOM_VK_DECIMAL:Int = 110
staticinlineread onlyDOM_VK_DELETE:Int = 46
staticinlineread onlyDOM_VK_DIVIDE:Int = 111
staticinlineread onlyDOM_VK_DOLLAR:Int = 164
staticinlineread onlyDOM_VK_DOUBLE_QUOTE:Int = 162
staticinlineread onlyDOM_VK_DOWN:Int = 40
staticinlineread onlyDOM_VK_E:Int = 69
staticinlineread onlyDOM_VK_EISU:Int = 22
staticinlineread onlyDOM_VK_END:Int = 35
staticinlineread onlyDOM_VK_EQUALS:Int = 61
staticinlineread onlyDOM_VK_EREOF:Int = 249
staticinlineread onlyDOM_VK_ESCAPE:Int = 27
staticinlineread onlyDOM_VK_EXCLAMATION:Int = 161
staticinlineread onlyDOM_VK_EXECUTE:Int = 43
staticinlineread onlyDOM_VK_EXSEL:Int = 248
staticinlineread onlyDOM_VK_F:Int = 70
staticinlineread onlyDOM_VK_F1:Int = 112
staticinlineread onlyDOM_VK_F10:Int = 121
staticinlineread onlyDOM_VK_F11:Int = 122
staticinlineread onlyDOM_VK_F12:Int = 123
staticinlineread onlyDOM_VK_F13:Int = 124
staticinlineread onlyDOM_VK_F14:Int = 125
staticinlineread onlyDOM_VK_F15:Int = 126
staticinlineread onlyDOM_VK_F16:Int = 127
staticinlineread onlyDOM_VK_F17:Int = 128
staticinlineread onlyDOM_VK_F18:Int = 129
staticinlineread onlyDOM_VK_F19:Int = 130
staticinlineread onlyDOM_VK_F2:Int = 113
staticinlineread onlyDOM_VK_F20:Int = 131
staticinlineread onlyDOM_VK_F21:Int = 132
staticinlineread onlyDOM_VK_F22:Int = 133
staticinlineread onlyDOM_VK_F23:Int = 134
staticinlineread onlyDOM_VK_F24:Int = 135
staticinlineread onlyDOM_VK_F3:Int = 114
staticinlineread onlyDOM_VK_F4:Int = 115
staticinlineread onlyDOM_VK_F5:Int = 116
staticinlineread onlyDOM_VK_F6:Int = 117
staticinlineread onlyDOM_VK_F7:Int = 118
staticinlineread onlyDOM_VK_F8:Int = 119
staticinlineread onlyDOM_VK_F9:Int = 120
staticinlineread onlyDOM_VK_FINAL:Int = 24
staticinlineread onlyDOM_VK_G:Int = 71
staticinlineread onlyDOM_VK_GREATER_THAN:Int = 62
staticinlineread onlyDOM_VK_H:Int = 72
staticinlineread onlyDOM_VK_HANGUL:Int = 21
staticinlineread onlyDOM_VK_HANJA:Int = 25
staticinlineread onlyDOM_VK_HASH:Int = 163
staticinlineread onlyDOM_VK_HELP:Int = 6
staticinlineread onlyDOM_VK_HOME:Int = 36
staticinlineread onlyDOM_VK_HYPHEN_MINUS:Int = 173
staticinlineread onlyDOM_VK_I:Int = 73
staticinlineread onlyDOM_VK_INSERT:Int = 45
staticinlineread onlyDOM_VK_J:Int = 74
staticinlineread onlyDOM_VK_JUNJA:Int = 23
staticinlineread onlyDOM_VK_K:Int = 75
staticinlineread onlyDOM_VK_KANA:Int = 21
staticinlineread onlyDOM_VK_KANJI:Int = 25
staticinlineread onlyDOM_VK_L:Int = 76
staticinlineread onlyDOM_VK_LEFT:Int = 37
staticinlineread onlyDOM_VK_LESS_THAN:Int = 60
staticinlineread onlyDOM_VK_M:Int = 77
staticinlineread onlyDOM_VK_META:Int = 224
staticinlineread onlyDOM_VK_MODECHANGE:Int = 31
staticinlineread onlyDOM_VK_MULTIPLY:Int = 106
staticinlineread onlyDOM_VK_N:Int = 78
staticinlineread onlyDOM_VK_NONCONVERT:Int = 29
staticinlineread onlyDOM_VK_NUMPAD0:Int = 96
staticinlineread onlyDOM_VK_NUMPAD1:Int = 97
staticinlineread onlyDOM_VK_NUMPAD2:Int = 98
staticinlineread onlyDOM_VK_NUMPAD3:Int = 99
staticinlineread onlyDOM_VK_NUMPAD4:Int = 100
staticinlineread onlyDOM_VK_NUMPAD5:Int = 101
staticinlineread onlyDOM_VK_NUMPAD6:Int = 102
staticinlineread onlyDOM_VK_NUMPAD7:Int = 103
staticinlineread onlyDOM_VK_NUMPAD8:Int = 104
staticinlineread onlyDOM_VK_NUMPAD9:Int = 105
staticinlineread onlyDOM_VK_NUM_LOCK:Int = 144
staticinlineread onlyDOM_VK_O:Int = 79
staticinlineread onlyDOM_VK_OPEN_BRACKET:Int = 219
staticinlineread onlyDOM_VK_OPEN_CURLY_BRACKET:Int = 174
staticinlineread onlyDOM_VK_OPEN_PAREN:Int = 168
staticinlineread onlyDOM_VK_P:Int = 80
staticinlineread onlyDOM_VK_PA1:Int = 253
staticinlineread onlyDOM_VK_PAGE_DOWN:Int = 34
staticinlineread onlyDOM_VK_PAGE_UP:Int = 33
staticinlineread onlyDOM_VK_PAUSE:Int = 19
staticinlineread onlyDOM_VK_PERCENT:Int = 165
staticinlineread onlyDOM_VK_PERIOD:Int = 190
staticinlineread onlyDOM_VK_PIPE:Int = 172
staticinlineread onlyDOM_VK_PLAY:Int = 250
staticinlineread onlyDOM_VK_PLUS:Int = 171
staticinlineread onlyDOM_VK_PRINT:Int = 42
staticinlineread onlyDOM_VK_PRINTSCREEN:Int = 44
staticinlineread onlyDOM_VK_PROCESSKEY:Int = 229
staticinlineread onlyDOM_VK_Q:Int = 81
staticinlineread onlyDOM_VK_QUESTION_MARK:Int = 63
staticinlineread onlyDOM_VK_QUOTE:Int = 222
staticinlineread onlyDOM_VK_R:Int = 82
staticinlineread onlyDOM_VK_RETURN:Int = 13
staticinlineread onlyDOM_VK_RIGHT:Int = 39
staticinlineread onlyDOM_VK_S:Int = 83
staticinlineread onlyDOM_VK_SCROLL_LOCK:Int = 145
staticinlineread onlyDOM_VK_SELECT:Int = 41
staticinlineread onlyDOM_VK_SEMICOLON:Int = 59
staticinlineread onlyDOM_VK_SEPARATOR:Int = 108
staticinlineread onlyDOM_VK_SHIFT:Int = 16
staticinlineread onlyDOM_VK_SLASH:Int = 191
staticinlineread onlyDOM_VK_SLEEP:Int = 95
staticinlineread onlyDOM_VK_SPACE:Int = 32
staticinlineread onlyDOM_VK_SUBTRACT:Int = 109
staticinlineread onlyDOM_VK_T:Int = 84
staticinlineread onlyDOM_VK_TAB:Int = 9
staticinlineread onlyDOM_VK_TILDE:Int = 176
staticinlineread onlyDOM_VK_U:Int = 85
staticinlineread onlyDOM_VK_UNDERSCORE:Int = 167
staticinlineread onlyDOM_VK_UP:Int = 38
staticinlineread onlyDOM_VK_V:Int = 86
staticinlineread onlyDOM_VK_VOLUME_DOWN:Int = 182
staticinlineread onlyDOM_VK_VOLUME_MUTE:Int = 181
staticinlineread onlyDOM_VK_VOLUME_UP:Int = 183
staticinlineread onlyDOM_VK_W:Int = 87
staticinlineread onlyDOM_VK_WIN:Int = 91
staticinlineread onlyDOM_VK_WIN_ICO_00:Int = 228
staticinlineread onlyDOM_VK_WIN_ICO_CLEAR:Int = 230
staticinlineread onlyDOM_VK_WIN_ICO_HELP:Int = 227
staticinlineread onlyDOM_VK_WIN_OEM_ATTN:Int = 240
staticinlineread onlyDOM_VK_WIN_OEM_AUTO:Int = 243
staticinlineread onlyDOM_VK_WIN_OEM_BACKTAB:Int = 245
staticinlineread onlyDOM_VK_WIN_OEM_CLEAR:Int = 254
staticinlineread onlyDOM_VK_WIN_OEM_COPY:Int = 242
staticinlineread onlyDOM_VK_WIN_OEM_CUSEL:Int = 239
staticinlineread onlyDOM_VK_WIN_OEM_ENLW:Int = 244
staticinlineread onlyDOM_VK_WIN_OEM_FINISH:Int = 241
staticinlineread onlyDOM_VK_WIN_OEM_FJ_JISHO:Int = 146
staticinlineread onlyDOM_VK_WIN_OEM_FJ_LOYA:Int = 149
staticinlineread onlyDOM_VK_WIN_OEM_FJ_MASSHOU:Int = 147
staticinlineread onlyDOM_VK_WIN_OEM_FJ_ROYA:Int = 150
staticinlineread onlyDOM_VK_WIN_OEM_FJ_TOUROKU:Int = 148
staticinlineread onlyDOM_VK_WIN_OEM_JUMP:Int = 234
staticinlineread onlyDOM_VK_WIN_OEM_PA1:Int = 235
staticinlineread onlyDOM_VK_WIN_OEM_PA2:Int = 236
staticinlineread onlyDOM_VK_WIN_OEM_PA3:Int = 237
staticinlineread onlyDOM_VK_WIN_OEM_RESET:Int = 233
staticinlineread onlyDOM_VK_WIN_OEM_WSCTRL:Int = 238
staticinlineread onlyDOM_VK_X:Int = 88
staticinlineread onlyDOM_VK_Y:Int = 89
staticinlineread onlyDOM_VK_Z:Int = 90
staticinlineread onlyDOM_VK_ZOOM:Int = 251
Constructor
new(typeArg:String, ?keyboardEventInitDict:Null<KeyboardEventInit>)
Throws:
null |
DOMError |
---|
Variables
read onlyaltKey:Bool
Returns a Boolean
that is true
if the Alt ( Option or ⌥ on OS X) key was active when the key event was generated.
read onlycharCode:Int
Returns a Number
representing the Unicode reference number of the key; this attribute is used only by the keypress
event. For keys whose char
attribute contains multiple characters, this is the Unicode value of the first character in that attribute. In Firefox 26 this returns codes for printable characters. Warning: This attribute is deprecated; you should use KeyboardEvent.key
instead, if available.
read onlycode:String
Returns a DOMString
with the code value of the key represented by the event.
read onlyctrlKey:Bool
Returns a Boolean
that is true
if the Ctrl key was active when the key event was generated.
read onlyisComposing:Bool
Returns a Boolean
that is true
if the event is fired between after compositionstart
and before compositionend
.
read onlykey:String
Returns a DOMString
representing the key value of the key represented by the event.
read onlykeyCode:Int
Returns a Number
representing a system and implementation dependent numerical code identifying the unmodified value of the pressed key. Warning: This attribute is deprecated; you should use KeyboardEvent.key
instead, if available.
read onlylocation:Int
Returns a Number
representing the location of the key on the keyboard or other input device.
read onlymetaKey:Bool
Returns a Boolean
that is true
if the Meta key (on Mac keyboards, the ⌘ Command key; on Windows keyboards, the Windows key (⊞)) was active when the key event was generated.
read onlyrepeat:Bool
Returns a Boolean
that is true
if the key is being held down such that it is automatically repeating.
read onlyshiftKey:Bool
Returns a Boolean
that is true
if the Shift key was active when the key event was generated.
Methods
getModifierState(key:String):Bool
Returns a Boolean
indicating if a modifier key such as Alt, Shift, Ctrl, or Meta, was pressed when the event was created.
initKeyEvent(type:String, canBubble:Bool = false, cancelable:Bool = false, ?view:Window, ctrlKey:Bool = false, altKey:Bool = false, shiftKey:Bool = false, metaKey:Bool = false, keyCode:Int = 0, charCode:Int = 0):Void
Initializes a KeyboardEvent
object. This was implemented only by Firefox, and is no longer supported even there; instead, you should use the KeyboardEvent.KeyboardEvent
constructor.
initKeyboardEvent(typeArg:String, bubblesArg:Bool = false, cancelableArg:Bool = false, ?viewArg:Window, keyArg:String = "", locationArg:Int = 0, ctrlKey:Bool = false, altKey:Bool = false, shiftKey:Bool = false, metaKey:Bool = false):Void
Initializes a KeyboardEvent
object. This is now deprecated. You should instead use the KeyboardEvent.KeyboardEvent
constructor.
Throws:
null |
DOMError |
---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/KeyboardEvent.html