1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 10:40:54 +00:00
psychojs/docs/module-core.PsychoJS.html
2018-12-28 13:43:48 +01:00

2436 lines
31 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: PsychoJS</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: PsychoJS</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-core.html">core</a>.</span>PsychoJS<span class="signature">(options)</span><span class="type-signature"></span></h2>
<div class="class-description"><p>PsychoJS manages the lifecycle of an experiment. It initialises the PsychoJS library and its various components (e.g. the <a href="ServerManager.html">ServerManager</a>, the <a href="EventManager.html">EventManager</a>), and is used by the experiment to schedule the various tasks.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="PsychoJS"><span class="type-signature"></span>new PsychoJS<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>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>debug</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">whether or not to log debug information in the browser console</td>
</tr>
<tr>
<td class="name"><code>collectIP</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">whether or not to collect the IP information of the participant</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_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".Status"><span class="type-signature">(static, readonly) </span>Status<span class="type-signature"> :Symbol</span></h4>
<div class="description">
PsychoJS status
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Symbol</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>NOT_CONFIGURED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>CONFIGURING</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>CONFIGURED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>NOT_STARTED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>STARTED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>FINISHED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>STOPPED</code></td>
<td class="type">
<span class="param-type">Symbol</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line427">line 427</a>
</li></ul></dd>
</dl>
<h4 class="name" id="status"><span class="type-signature"></span>status<span class="type-signature"></span></h4>
<div class="description">
Properties
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line35">line 35</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_captureErrors"><span class="type-signature">(protected) </span>_captureErrors<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Capture all errors and display them in a pop-up error box.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line395">line 395</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_configure"><span class="type-signature">(async, protected) </span>_configure<span class="signature">(configURL)</span><span class="type-signature"></span></h4>
<div class="description">
Configure PsychoJS for the running experiment.
</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>configURL</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the URL of the configuration file</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line324">line 324</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_getParticipantIPInfo"><span class="type-signature">(async, protected) </span>_getParticipantIPInfo<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Get the IP information of the participant, asynchronously.
<p>Note: we use <a href="http://www.geoplugin.net/json.gp">http://www.geoplugin.net/json.gp</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line367">line 367</a>
</li></ul></dd>
</dl>
<h4 class="name" id="importAttributes"><span class="type-signature"></span>importAttributes<span class="signature">(obj)</span><span class="type-signature"></span></h4>
<div class="description">
Make the attributes of the given object those of PsychoJS and those of
the top level variable (e.g. window) as well.
</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>obj</code></td>
<td class="type">
<span class="param-type">Object.&lt;string, *></span>
</td>
<td class="description last">the object whose attributes we will mirror</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line245">line 245</a>
</li></ul></dd>
</dl>
<h4 class="name" id="openWindow"><span class="type-signature"></span>openWindow<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
Open a PsychoJS Window.
<p>This opens a PIXI canvas.</p>
<p>Note: we can only open one window.</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 class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">the name of the window</td>
</tr>
<tr>
<td class="name"><code>fullscr</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">whether or not to go fullscreen</td>
</tr>
<tr>
<td class="name"><code>color</code></td>
<td class="type">
<span class="param-type">Color</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">the background color of the window</td>
</tr>
<tr>
<td class="name"><code>units</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">the units of the window</td>
</tr>
<tr>
<td class="name"><code>autoLog</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">whether of not to log</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_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line112">line 112</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
exception if a window has already been opened
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object.&lt;string, *></span>
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h4 class="name" id="quit"><span class="type-signature">(async) </span>quit<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
Close everything and exit nicely at the end of the experiment,
potentially redirecting to one of the URLs previously specified by setRedirectUrls.
<p>Note: if the resource manager is busy, we inform the participant
that he or she needs to wait for a bit.</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>message</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">optional message to be displayed in a dialog box before quitting</td>
</tr>
<tr>
<td class="name"><code>isCompleted</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">whether or not the participant has completed the experiment</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_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line271">line 271</a>
</li></ul></dd>
</dl>
<h4 class="name" id="schedule"><span class="type-signature"></span>schedule<span class="signature">(task, args)</span><span class="type-signature"></span></h4>
<div class="description">
Schedule a task.
</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>task</code></td>
<td class="type">
</td>
<td class="description last">the task to be scheduled</td>
</tr>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
</td>
<td class="description last">arguments for that task</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line152">line 152</a>
</li></ul></dd>
</dl>
<h4 class="name" id="scheduleCondition"><span class="type-signature"></span>scheduleCondition<span class="signature">(condition, thenScheduler, elseScheduler)</span><span class="type-signature"></span></h4>
<div class="description">
Schedule a series of task based on a condition.
</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>condition</code></td>
<td class="type">
<span class="param-type"><a href="PsychoJS.html#.condition">PsychoJS.condition</a></span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thenScheduler</code></td>
<td class="type">
<span class="param-type">Scheduler</span>
</td>
<td class="description last">scheduler to run if the condition is true</td>
</tr>
<tr>
<td class="name"><code>elseScheduler</code></td>
<td class="type">
<span class="param-type">Scheduler</span>
</td>
<td class="description last">scheduler to run if the condition is false</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line171">line 171</a>
</li></ul></dd>
</dl>
<h4 class="name" id="setRedirectUrls"><span class="type-signature"></span>setRedirectUrls<span class="signature">(completionUrl, cancellationUrl)</span><span class="type-signature"></span></h4>
<div class="description">
Set the completion and cancellation URL to which the participant will be redirect at the end of the experiment.
</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>completionUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the completion URL</td>
</tr>
<tr>
<td class="name"><code>cancellationUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the cancellation URL</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="core_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line140">line 140</a>
</li></ul></dd>
</dl>
<h4 class="name" id="start"><span class="type-signature">(async) </span>start<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
Start the experiment.
</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>configURL</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
config.json
</td>
<td class="description last">the URL of the configuration file</td>
</tr>
<tr>
<td class="name"><code>expInfo</code></td>
<td class="type">
<span class="param-type">Object.&lt;string, *></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">additional information about the experiment</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_PsychoJS.js.html">core/PsychoJS.js</a>, <a href="core_PsychoJS.js.html#line187">line 187</a>
</li></ul></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.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.Logger.html">Logger</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.ImageStim.html">ImageStim</a></li><li><a href="module-visual.MovieStim.html">MovieStim</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.TextStim.html">TextStim</a></li><li><a href="module-visual.VisualStim.html">VisualStim</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><h3>Interfaces</h3><ul><li><a href="module-sound.SoundPlayer.html">SoundPlayer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Dec 28 2018 13:41:42 GMT+0100 (CET)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>