Constructor
new EventManager(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
|
- Source:
Members
(private, readonly) _keycodeMap :Object.<number, String>
This map provides support for browsers that have not yet
adopted the W3C KeyboardEvent.code standard for detecting key presses.
It maps the deprecated KeyboardEvent.keycode values to the W3C UI event codes.
Unfortunately, it is not very fine-grained: for instance, there is no difference between Alt Left and Alt
Right, or between Enter and Numpad Enter. Use at your own risk (or upgrade your browser...).
Type:
- Source:
(private, readonly) _pygletMap :Object.<String, String>
This map associates pyglet key names to the corresponding W3C KeyboardEvent codes values.
More information can be found here
Type:
- Source:
(private, readonly) _reversePygletMap :Object.<String, String>
This map associates W3C KeyboardEvent.codes to the corresponding pyglet key names.
Type:
- Source:
Methods
(private) _addKeyListeners()
Add key listeners to the document.
- Source:
addMouseListeners(renderer)
Add various mouse listeners to the Pixi renderer of the Window.
Parameters:
Name |
Type |
Description |
renderer |
PIXI.Renderer
|
The Pixi renderer |
- Source:
clearEvents()
Clear all events from the event buffer.
- Source:
- To Do:
-
- handle the attribs argument
clearKeys()
Clear all keys from the key buffer.
- Source:
getKeys(options) → {Array.<string>}
Get the list of keys pressed by the participant.
Note: The w3c key-event viewer can be used to see possible values for the items in the keyList given the user's keyboard and chosen layout. The "key" and "code" columns in the UI Events fields are the relevant values for the keyList argument.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Attributes |
Default |
Description |
keyList |
Array.<string>
|
<optional>
|
null
|
keyList allows the user to specify a set of keys to check for. Only keypresses from this set of keys will be removed from the keyboard buffer. If no keyList is given, all keys will be checked and the key buffer will be cleared completely. |
timeStamped |
boolean
|
<optional>
|
false
|
If true will return a list of tuples instead of a list of keynames. Each tuple has (keyname, time). |
|
- Source:
Returns:
the list of keys that were pressed.
-
Type
-
Array.<string>
Get the mouse info.
- Source:
Returns:
the mouse info.
-
Type
-
EventManager.MouseInfo
keycode2w3c(keycode) → {string}
Convert a keycode to a W3C UI Event code.
This is for legacy browsers.
Parameters:
Name |
Type |
Description |
keycode |
number
|
the keycode |
- Source:
Returns:
corresponding W3C UI Event code
-
Type
-
string
pyglet2w3c(pygletKeyList) → {Array.string}
Convert a keylist that uses pyglet key names to one that uses W3C KeyboardEvent.code values.
This allows key lists that work in the builder environment to work in psychoJS web experiments.
Parameters:
Name |
Type |
Description |
pygletKeyList |
Array.string
|
the array of pyglet key names |
- Source:
Returns:
the w3c keyList
-
Type
-
Array.string
resetMoveClock()
Reset the move clock.
- Source:
- To Do:
-
startMoveClock()
Start the move clock.
- Source:
- To Do:
-
stopMoveClock()
Stop the move clock.
- Source:
- To Do:
-
w3c2pyglet(code) → {string}
Convert a W3C Key Code into a pyglet key.
Parameters:
Name |
Type |
Description |
code |
string
|
W3C Key Code |
- Source:
Returns:
corresponding pyglet key
-
Type
-
string