1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00
psychojs/docs/module-core.EventManager.html
2021-02-20 12:18:07 +01:00

1736 lines
21 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: EventManager</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: EventManager</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-core.html">core</a>.</span>EventManager<span class="signature">(options)</span><span class="type-signature"></span></h2>
<div class="class-description"><p>This manager handles all participant interactions with the experiment, i.e. keyboard, mouse and touch events.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="EventManager"><span class="type-signature"></span>new EventManager<span class="signature">(options)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>psychoJS</code></td>
<td class="type">
<span class="param-type"><a href="module-core.PsychoJS.html">module:core.PsychoJS</a></span>
</td>
<td class="description last">the PsychoJS instance</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addMouseListeners"><span class="type-signature"></span>addMouseListeners<span class="signature">(renderer)</span><span class="type-signature"></span></h4>
<div class="description">
Add various mouse listeners to the Pixi renderer of the Window.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>renderer</code></td>
<td class="type">
<span class="param-type">PIXI.Renderer</span>
</td>
<td class="description last">The Pixi renderer</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line225">line 225</a>
</li></ul></dd>
</dl>
<h4 class="name" id="clearEvents"><span class="type-signature"></span>clearEvents<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Clear all events from the event buffer.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line155">line 155</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>handle the attribs argument</li>
</ul>
</dd>
</dl>
<h4 class="name" id="clearKeys"><span class="type-signature"></span>clearKeys<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Clear all keys from the key buffer.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line170">line 170</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getKeys"><span class="type-signature"></span>getKeys<span class="signature">(options)</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
<div class="description">
Get the list of keys pressed by the participant.
<p>Note: The w3c <a href="https://w3c.github.io/uievents/tools/key-event-viewer.html">key-event viewer</a> 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.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>keyList</code></td>
<td class="type">
<span class="param-type">Array.&lt;string></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">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.</td>
</tr>
<tr>
<td class="name"><code>timeStamped</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">If true will return a list of tuples instead of a list of keynames. Each tuple has (keyname, time).</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the list of keys that were pressed.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;string></span>
</dd>
</dl>
<h4 class="name" id="getMouseInfo"><span class="type-signature"></span>getMouseInfo<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="EventManager.html#.MouseInfo">EventManager.MouseInfo</a>}</span></h4>
<div class="description">
Get the mouse info.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line141">line 141</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the mouse info.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="EventManager.html#.MouseInfo">EventManager.MouseInfo</a></span>
</dd>
</dl>
<h4 class="name" id="keycode2w3c"><span class="type-signature"></span>keycode2w3c<span class="signature">(keycode)</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
Convert a keycode to a W3C UI Event code.
<p>This is for legacy browsers.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>keycode</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">the keycode</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line418">line 418</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
corresponding W3C UI Event code
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="pyglet2w3c"><span class="type-signature"></span>pyglet2w3c<span class="signature">(pygletKeyList)</span><span class="type-signature"> &rarr; {Array.string}</span></h4>
<div class="description">
Convert a keylist that uses pyglet key names to one that uses W3C KeyboardEvent.code values.
<p>This allows key lists that work in the builder environment to work in psychoJS web experiments.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pygletKeyList</code></td>
<td class="type">
<span class="param-type">Array.string</span>
</td>
<td class="description last">the array of pyglet key names</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line366">line 366</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the w3c keyList
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.string</span>
</dd>
</dl>
<h4 class="name" id="resetMoveClock"><span class="type-signature"></span>resetMoveClock<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Reset the move clock.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line211">line 211</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>not implemented</li>
</ul>
</dd>
</dl>
<h4 class="name" id="startMoveClock"><span class="type-signature"></span>startMoveClock<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Start the move clock.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line183">line 183</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>not implemented</li>
</ul>
</dd>
</dl>
<h4 class="name" id="stopMoveClock"><span class="type-signature"></span>stopMoveClock<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Stop the move clock.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line197">line 197</a>
</li></ul></dd>
<dt class="tag-todo">To Do:</dt>
<dd class="tag-todo">
<ul>
<li>not implemented</li>
</ul>
</dd>
</dl>
<h4 class="name" id="w3c2pyglet"><span class="type-signature"></span>w3c2pyglet<span class="signature">(code)</span><span class="type-signature"> &rarr; {string}</span></h4>
<div class="description">
Convert a W3C Key Code into a pyglet key.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">W3C Key Code</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_EventManager.js.html">core/EventManager.js</a>, <a href="core_EventManager.js.html#line395">line 395</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
corresponding pyglet key
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-core.html">core</a></li><li><a href="module-data.html">data</a></li><li><a href="module-sound.html">sound</a></li><li><a href="module-util.html">util</a></li><li><a href="module-visual.html">visual</a></li></ul><h3>Classes</h3><ul><li><a href="module-core.BuilderKeyResponse.html">BuilderKeyResponse</a></li><li><a href="module-core.EventManager.html">EventManager</a></li><li><a href="module-core.GUI.html">GUI</a></li><li><a href="module-core.Keyboard.html">Keyboard</a></li><li><a href="module-core.KeyPress.html">KeyPress</a></li><li><a href="module-core.Logger.html">Logger</a></li><li><a href="module-core.MinimalStim.html">MinimalStim</a></li><li><a href="module-core.Mouse.html">Mouse</a></li><li><a href="module-core.PsychoJS.html">PsychoJS</a></li><li><a href="module-core.ServerManager.html">ServerManager</a></li><li><a href="module-core.Window.html">Window</a></li><li><a href="module-data.ExperimentHandler.html">ExperimentHandler</a></li><li><a href="module-data.TrialHandler.html">TrialHandler</a></li><li><a href="module-sound.Sound.html">Sound</a></li><li><a href="module-sound.TonePlayer.html">TonePlayer</a></li><li><a href="module-sound.TrackPlayer.html">TrackPlayer</a></li><li><a href="module-util.Clock.html">Clock</a></li><li><a href="module-util.Color.html">Color</a></li><li><a href="module-util.CountdownTimer.html">CountdownTimer</a></li><li><a href="module-util.EventEmitter.html">EventEmitter</a></li><li><a href="module-util.MixinBuilder.html">MixinBuilder</a></li><li><a href="module-util.MonotonicClock.html">MonotonicClock</a></li><li><a href="module-util.PsychObject.html">PsychObject</a></li><li><a href="module-util.Scheduler.html">Scheduler</a></li><li><a href="module-visual.Form.html">Form</a></li><li><a href="module-visual.ImageStim.html">ImageStim</a></li><li><a href="module-visual.MovieStim.html">MovieStim</a></li><li><a href="module-visual.Polygon.html">Polygon</a></li><li><a href="module-visual.Rect.html">Rect</a></li><li><a href="module-visual.ShapeStim.html">ShapeStim</a></li><li><a href="module-visual.Slider.html">Slider</a></li><li><a href="module-visual.TextBox.html">TextBox</a></li><li><a href="module-visual.TextStim.html">TextStim</a></li><li><a href="module-visual.VisualStim.html">VisualStim</a></li><li><a href="TextInput.html">TextInput</a></li></ul><h3>Interfaces</h3><ul><li><a href="module-sound.SoundPlayer.html">SoundPlayer</a></li></ul><h3>Mixins</h3><ul><li><a href="module-core.WindowMixin.html">WindowMixin</a></li><li><a href="module-util.ColorMixin.html">ColorMixin</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sat Feb 20 2021 10:19:19 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>