new Scheduler(psychoJS)
A scheduler helps run the main loop by managing scheduled functions, called tasks, after each frame is displayed.
Tasks are either another Scheduler, or a JavaScript functions returning one of the following codes:
- Scheduler.Event.NEXT: Move onto the next task *without* rendering the scene first.
- Scheduler.Event.FLIP_REPEAT: Render the scene and repeat the task.
- Scheduler.Event.FLIP_NEXT: Render the scene and move onto the next task.
- Scheduler.Event.QUIT: Quit the scheduler.
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 scheduler.add(subScheduler).
Conditional branching is also available: scheduler.addConditionalBranches
Parameters:
Name | Type | Description |
---|---|---|
psychoJS |
PsychoJS | the PsychoJS instance |
- Source:
Members
(private) _runNextTasks
Run the next scheduled tasks, in sequence, until a rendering of the scene is requested.
- Source:
add
Schedule a new task.
- Source:
addConditional
Schedule a series of task or another, based on a condition.
Note: the tasks are sub-schedulers.
- Source:
(readonly) Event :Symbol
Events.
Type:
- Symbol
- Source:
start
Start this scheduler.
Note: tasks are run after each animation frame.
- Source:
(readonly) Status :Symbol
Status.
Type:
- Symbol
- Source:
status
Get the status of the scheduler.
- Source:
stop
Stop this scheduler.
- Source:
Type Definitions
Condition() → {boolean}
Condition evaluated when the task is run.
- Source:
Returns:
- Type
- boolean
Task(argsopt)
Task to be run by the scheduler.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<optional> |
optional arguments |
- Source: