Class: EventManager

core.EventManager(options)

This manager handles all participant interactions with the experiment, i.e. keyboard, mouse and touch events.

Constructor

new EventManager(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Description
psychoJS module:core.PsychoJS the PsychoJS instance
Source:

Methods

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>

getMouseInfo() → {EventManager.MouseInfo}

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:
  • not implemented

startMoveClock()

Start the move clock.
Source:
To Do:
  • not implemented

stopMoveClock()

Stop the move clock.
Source:
To Do:
  • not implemented

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