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

960 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Scheduler</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: Scheduler</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-util.html">util</a>.</span>Scheduler<span class="signature">(psychoJS)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Scheduler"><span class="type-signature"></span>new Scheduler<span class="signature">(psychoJS)</span><span class="type-signature"></span></h4>
<div class="description">
<p>A scheduler helps run the main loop by managing scheduled functions,
called tasks, after each frame is displayed.</p>
<p>
Tasks are either another <a href="module-util.Scheduler.html">Scheduler</a>, or a
JavaScript functions returning one of the following codes:
<ul>
<li>Scheduler.Event.NEXT: Move onto the next task *without* rendering the scene first.</li>
<li>Scheduler.Event.FLIP_REPEAT: Render the scene and repeat the task.</li>
<li>Scheduler.Event.FLIP_NEXT: Render the scene and move onto the next task.</li>
<li>Scheduler.Event.QUIT: Quit the scheduler.</li>
</ul>
</p>
<p> It is possible to create sub-schedulers, e.g. to handle loops.
Sub-schedulers are added to a parent scheduler as a normal
task would be by calling <a href="module-util.Scheduler.html#add">scheduler.add(subScheduler)</a>.</p>
<p> Conditional branching is also available:
<a href="module-util.Scheduler.html#addConditional">scheduler.addConditionalBranches</a></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>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>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="type-signature"></span></h4>
<div class="description">
Schedule a new task.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addConditional"><span class="type-signature"></span>addConditional<span class="type-signature"></span></h4>
<div class="description">
Schedule a series of task or another, based on a condition.
<p>Note: the tasks are <a href="module-util.Scheduler.html">sub-schedulers</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line97">line 97</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Event"><span class="type-signature">(readonly) </span>Event<span class="type-signature"> :Symbol</span></h4>
<div class="description">
Events.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Symbol</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line271">line 271</a>
</li></ul></dd>
</dl>
<h4 class="name" id="start"><span class="type-signature"></span>start<span class="type-signature"></span></h4>
<div class="description">
Start this scheduler.
<p>Note: tasks are run after each animation frame.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line129">line 129</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">
Get the status of the scheduler.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line57">line 57</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Status"><span class="type-signature">(readonly) </span>Status<span class="type-signature"> :Symbol</span></h4>
<div class="description">
Status.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Symbol</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line302">line 302</a>
</li></ul></dd>
</dl>
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="type-signature"></span></h4>
<div class="description">
Stop this scheduler.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line177">line 177</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="~Condition"><span class="type-signature"></span>Condition<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Condition evaluated when the task is run.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line91">line 91</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="~Task"><span class="type-signature"></span>Task<span class="signature">(args<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Task to be run by the scheduler.
</div>
<h5>Parameters:</h5>
<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>args</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">optional arguments</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util_Scheduler.js.html">util/Scheduler.js</a>, <a href="util_Scheduler.js.html#line70">line 70</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.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:20 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>