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 PsychoJS the PsychoJS instance
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.

Type:
  • Object.<number, String>
Source:

(private, readonly) _pygletMap :Object.<String, String>

This map associates pyglet key names to the corresponding W3C KeyboardEvent.codes.

Type:
  • Object.<String, String>
Source:

(private, readonly) _reversePygletMap :Object.<String, String>

This map associates W3C KeyboardEvent.codes to the corresponding pyglet key names.

Type:
  • Object.<String, String>
Source:

Methods

(private) _addKeyListeners()

Add key listeners to the document.
Source:

(private) _pyglet2w3c(keyList) → {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
keyList Array.string the array of pyglet key names
Source:
Returns:
the w3c keyList
Type
Array.string

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

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