Constructor
new Keyboard()
Methods
destroy()
- Source:
unbind the keydown / keyup events
isPressed(code) → {Boolean}
- Source:
query keyboard state to know if a key is pressed of not
Parameters:
Name | Type | Description |
---|---|---|
code |
String | Array | single keycode or array of keycodes |
Returns:
true if the key is pressed, false otherwise
- Type
- Boolean
time(code) → {Integer}
- Source:
query keyboard state to know if a key is pressed of not
Parameters:
Name | Type | Description |
---|---|---|
code |
String | the description of the key. format : modifiers+key e.g shift+A |
Returns:
Millisecond timestamp of the time it was last pressed or released
- Type
- Integer
Events
down
- Source:
Properties:
Name | Type | Description |
---|---|---|
pressed |
Boolean | Indicates whether the key is pressed or not |
time |
Number | Indicates when the keypress occured |
Keydown event.
up
- Source:
Properties:
Name | Type | Description |
---|---|---|
pressed |
Boolean | Indicates whether the key is pressed or not |
time |
Number | Indicates when the keypress occured |
Keyup event.