Merge branch 'master' into preload-docs

This commit is contained in:
Josh de Leeuw 2021-02-12 11:28:47 -05:00
commit 969484f0e6
53 changed files with 556 additions and 426 deletions

View File

@ -608,7 +608,7 @@ jsPsych.timelineVariable(variable, call_immediate)
Parameter | Type | Description Parameter | Type | Description
----------|------|------------ ----------|------|------------
variable | string | Name of the timeline variable variable | string | Name of the timeline variable
call_immediate | bool | This parameter is optional and can usually be omitted. It determines the return value of `jsPsych.timelineVariable`. If `true`, the function returns the _value_ of the current timeline variable. If `false`, the function returns _a function that returns the value_ of the current timeline variable. When `call_immediate` is omitted, the appropriate option is determined automatically based on the context in which this function is called. When `jsPsych.timelineVariable` is used as a parameter value, `call_immediate` will be `false`. This allows it to be used as a [dynamic trial parameter](/overview/trial/#dynamic-parameters). When `jsPsych.timelineVariable` is used inside of a function, `call_immediate` will be `true`. It is possible to explicitly set this option to `true` to force the function to immediately return the current value of the timeline variable. call_immediate | bool | This parameter is optional and can usually be omitted. It determines the return value of `jsPsych.timelineVariable`. If `true`, the function returns the _value_ of the current timeline variable. If `false`, the function returns _a function that returns the value_ of the current timeline variable. When `call_immediate` is omitted, the appropriate option is determined automatically based on the context in which this function is called. When `jsPsych.timelineVariable` is used as a parameter value, `call_immediate` will be `false`. This allows it to be used as a [dynamic trial parameter](/overview/dynamic-parameters). When `jsPsych.timelineVariable` is used inside of a function, `call_immediate` will be `true`. It is possible to explicitly set this option to `true` to force the function to immediately return the current value of the timeline variable.
### Return value ### Return value
@ -658,7 +658,7 @@ var procedure = {
] ]
} }
``` ```
Prior to jsPsych v6.3.0, the `call_immediate` parameter must be set to `true` when `jsPsych.timelineVariable` is called from within a function, such as a [dynamic parameter](/overview/trial/#dynamic-parameters): Prior to jsPsych v6.3.0, the `call_immediate` parameter must be set to `true` when `jsPsych.timelineVariable` is called from within a function, such as a [dynamic parameter](/overview/dynamic-parameters):
```javascript ```javascript
var trial = { var trial = {
type: 'html-keyboard-response', type: 'html-keyboard-response',

View File

@ -212,13 +212,13 @@ jsPsych.pluginAPI.getKeyboardResponse({
}); });
``` ```
#### Get a responses from a key until the letter Q is pressed #### Get a responses from a key until the letter q is pressed
```javascript ```javascript
var after_response = function(info){ var after_response = function(info){
alert('You pressed key '+info.key+' after '+info.rt+'ms'); alert('You pressed key '+info.key+' after '+info.rt+'ms');
if(info.key == 81){ // the key code for 'Q' is 81. if(info.key == 'q'){ /
jsPsych.pluginAPI.cancelKeyboardResponse(listener); jsPsych.pluginAPI.cancelKeyboardResponse(listener);
} }
} }

View File

@ -0,0 +1,147 @@
# Dynamic parameters
Most trial parameters can also be specified as functions. In a typical declaration of a jsPsych trial, parameters are known at the start of the experiment. This makes it impossible to alter the content of the trial based on the outcome of previous trials. However, **when functions are used as the parameter value, the function is evaluated right before the trial starts, and the return value of the function is used as the parameter value for that trial**. This enables dynamic updating of the parameter based on data that a subject has generated or any other information that you do not know in advance.
## Examples
### Providing Feedback
Here is a sketch of how this functionality could be used to display feedback to a subject in the Flanker Task.
```javascript
var timeline = [];
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
},
on_finish: function(data){
// Score the response as correct or incorrect.
if(data.key_press == "f"){
data.correct = true;
} else {
data.correct = false;
}
}
}
var feedback = {
type: 'html-keyboard-response',
stimulus: function(){
// The feedback stimulus is a dynamic parameter because we can't know in advance whether
// the stimulus should be 'correct' or 'incorrect'.
// Instead, this function will check the accuracy of the last response and use that information to set
// the stimulus value on each trial.
var last_trial_correct = jsPsych.data.get().last(1).values()[0].correct;
if(last_trial_correct){
return "<p>Correct!</p>"; // the parameter value has to be returned from the function
} else {
return "<p>Wrong.</p>"; // the parameter value has to be returned from the function
}
}
}
timeline.push(trial, feedback);
```
### Randomizing a parameter value
Here's an example of using a dynamic parameter to randomize the inter-trial interval (ITI) duration. This time, the dynamic parameter is created using a named function instead of an anonymous function.
```js
var random_duration = function() {
var rand_dur = jsPsych.randomization.sampleWithoutReplacement([500,600,700,800],1)[0];
return rand_dur;
}
var trial = {
type: 'html-keyboard-response'
stimulus: '+',
post_trial_gap: random_duration // if you use a named function for a dynamic parameter, then just use the function name (without parentheses after it)
}
```
### Storing changing variables in the data
The trial's `data` parameter can be also function, which is useful for when you want to save information to the data that can change during the experiment. For example, if you have a global variable called `current_difficulty` that tracks the difficulty level in an adaptive task, you can save the current value of this variable to the trial data like this:
```js
var current_difficulty; // value changes during the experiment
var trial = {
type: 'survey-text',
questions: [{prompt: "Please enter your response."}]
data: function() {
return {difficulty: current_difficulty};
}
}
```
It's also possible to use a function for any of the _individual properties_ in the trial's `data` object, for instance if you want to combine static and dynamic information in the data:
```js
var trial = {
type: 'survey-text',
questions: [{prompt: "Please enter your response."}]
data: {
difficulty: function() {
return current_difficulty; // the difficulty value changes during the experiment
},
task_part: 'recall', // this part of the data is always the same
block_number: 1
}
}
```
## Nested Parameters
Dyanmic parameters work the same way with nested parameters, which are parameters that contain one or more sets of other parameters. For instance, many survey-* plugins have a `questions` parameter that is a nested parameter: it is an array that contains the parameters for one or more questions on the page. To make the `questions` parameter dynamic, you can use a function that returns the array with all of the parameters for each question:
```js
var subject_id; // value is set during the experiment
var trial = {
type: 'survey-text',
questions: function(){
var questions_array = [
{prompt: "Hi "+subject_id+"! What's your favorite city?", required: true, name: 'fav_city'},
{prompt: "What is your favorite fruit?", required: true, name: 'fav_fruit'},
];
return questions_array;
}
}
```
You can also use a function for any of the _individual parameters_ inside of a nested parameter.
```js
var trial = {
type: 'survey-text',
questions: [
{
prompt: function() {
// this question prompt is dynamic - the text that is shown
// will change based on the participant's earlier response
var favorite_city = JSON.parse(jsPsych.data.getLastTrialData().values()[0].responses).fav_city;
var text = "Earlier you said your favorite city is "+favorite_city+". What do you like most about "+favorite_city+"?"
return text;
},
required: true,
rows: 40,
columns: 10
},
{ prompt: "What is your favorite fruit?", required: true, name: 'fav_fruit' }
]
}
```
## When functions can't be used
Note that if the plugin *expects* the value of a given parameter to be a function, then this function *will not* be evaluated at the start of the trial. This is because some plugins allow the researcher to specify functions that should be called at some point during the trial. Some examples of this include the `stimulus` parameter in the canvas-* plugins, the `mistake_fn` parameter in the cloze plugin, and the `stim_function` parameter in the reconstruction plugin. If you want to check whether this is the case for a particular plugin and parameter, then the parameter's `type` in the `plugin.info` section of the plugin file. If the parameter type is `jsPsych.plugins.parameterType.FUNCTION`, then this parameter must be a function and it will not be executed before the trial starts.
Even though function evaluation doesn't work the same way with these parameters, the fact that the parameters are functions means that you can get the same dynamic functionality. These functions are typically evaluated at some point during the trial, so you still get updates to values within the function during the trial.

View File

@ -53,6 +53,9 @@ Exclusion criteria can be specified based on features of the user's web browser,
An automatic or manually updated progress bar can be displayed at the top of the screen. By default, the text next to the progress bar is "Completion Progress", but this text can be changed with the `message_progress_bar` parameter in `jsPsych.init`. See the [progress bar page](progress-bar.md) for more details. An automatic or manually updated progress bar can be displayed at the top of the screen. By default, the text next to the progress bar is "Completion Progress", but this text can be changed with the `message_progress_bar` parameter in `jsPsych.init`. See the [progress bar page](progress-bar.md) for more details.
## Preload media elements
Images, audio files, and movies can be preloaded to reduce latency during the experiment. In many cases, this preloading is automatic. In certain situations, such as using a custom plugin, using [timeline variables](timeline.md#timeline-variables), or using [functions to determine which stimulus to show](dynamic-parameters.md), it is necessary to provide jsPsych with a list of media elements to preload. The [media preloading](media-preloading.md) page describes this process in detail.
## Choose the method for playing audio files ## Choose the method for playing audio files

259
docs/overview/plugins.md Normal file
View File

@ -0,0 +1,259 @@
# Plugins
In jsPsych, plugins define the kinds of trials or events that should occur during the experiment. Some plugins define very general events, like displaying a set of instructions pages, displaying an image and recording a keyboard response, or playing a sound file and recording a button response. Other plugins are more specific, like those that display particular kinds of stimuli (e.g. Random-Dot Kinematogram, visual search circle), or run a specific version of particular kind of task (e.g. the Implicit Association Test). Creating an experiment with jsPsych involves figuring out which plugins are needed to create the tasks you want your participants to perform.
Plugins provide a structure for a particular trial or task, but often allow for significant customization and flexibility. For example, the `image-keyboard-response` plugin defines a simple structure for showing an image and collecting a keyboard response. You can specify the what the stimulus is, what keys the subject is allowed to press, and how long the stimulus should be on the screen, how long the subject has to respond, and so on. Many of these options have reasonable default values; even though the image plugin has many different parameters, you only *need* to specify the image stimulus in order to use it. Each plugin has its own documentation page, which describes what the plugin does, what options are available, and what kind of data it collects.
## Using a plugin
To use a plugin, you'll need to load the plugin's JavaScript file in your experiment's HTML page. All jsPsych experiments also need to load the "jsPsych.js" file.
```html
<head>
<script src="jsPsych/jspsych.js" type="text/javascript"></script>
<script src="jsPsych/plugins/jspsych-image-keyboard-response.js" type="text/javascript"></script>
</head>
```
Once a plugin is loaded, you can use JavaScript to define a trial that uses that plugin. All jsPsych trials have a `type`, which tells jsPsych what plugin to use to run the trial. The trial's `type` is the plugin name, which usually the same as the plugin file name, but with the "jspsych-" prefix removed.
The following JavaScript code defines a trial using the `image-keyboard-response` plugin to display an image file. This trial uses the default values for valid keys, stimulus duration, trial duration, and other parameters.
```javascript
var image_trial = {
type: 'image-keyboard-response',
stimulus: 'images/happy_face.jpg'
}
```
You can override any default parameter values by adding them into your trial object. Here's an exampe of overriding the default values for `trial_duration` and `post_trial_gap`:
```javascript
var image_trial = {
type: 'image-keyboard-response',
stimulus: 'images/happy_face.jpg',
trial_duration: 3000,
post_trial_gap: 2000
}
```
## Parameters available in all plugins
Each plugin specifies its own set of parameters. Check the documentation for a plugin to see what parameters are available and what they do.
There is also a set of parameters that can be specified for any plugin:
| Parameter | Type | Default Value | Description |
| -------------- | -------- | ----------------------- | ---------------------------------------- |
| data | object | *undefined* | An object containing additional data to store for the trial. See [the Data page](../overview/data.md) for more details. |
| post_trial_gap | numeric | null | Sets the time, in milliseconds, between the current trial and the next trial. If null, there will be no gap. |
| on_start | function | `function(){ return; }` | A callback function to execute when the trial begins, before any loading has occurred. See [the Event-Related Callbacks page](../overview/callbacks.md) for more details. |
| on_finish | function | `function(){ return; }` | A callback function to execute when the trial finishes, and before the next trial begins. See [the Event-Related Callbacks page](../overview/callbacks.md) for more details. |
| on_load | function | `function(){ return; }` | A callback function to execute when the trial has loaded, which typically happens after the initial display of the plugin has loaded. See [the Event-Related Callbacks page](../overview/callbacks.md) for more details. |
| css_classes | string | null | A list of CSS classes to add to the jsPsych display element for the duration of this trial. This allows you to create custom formatting rules (CSS classes) that are only applied to specific trials. For more information and examples, see the [Controlling Visual Appearance page](../overview/style.md) and the "css-classes-parameter.html" file in the jsPsych examples folder. |
### The data parameter
The `data` parameter allows you to add additional properties to the trial data. This can be useful for storing properties of the trial that are not directly apparent from the values that the plugin records. The `data` parameter value should be an object that contains key-value pairs.
A simple example is the [Flanker Task](https://en.wikipedia.org/wiki/Eriksen_flanker_task). In this experiment, participants respond to the direction of a central arrow by pressing a key to the left for a left-pointing arrow (<) and a key to the right for a right-pointing arrow (>). The arrow appears in the center of *flankers*, or arrows that the participant should ignore. Those flankers can be congruent (>>>>>) or incongruent (<<><<).
A trial for the Flanker Task written with jsPsych might look like this:
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
}
}
```
Note the use of the data parameter to add a property `stimulus_type` with the value `congruent` and a property `target_direction` with the value `left`. Having these properties recorded directly in the data simplifies data analysis, making it easy to aggregate data by `stimulus_type` and/or `target_direction`.
### The post_trial_gap (ITI) parameter
The default inter-trial interval (ITI) in jsPsych is 0 ms. This can be adjusted at the experiment-wide level by changing the `default_iti` parameter in `jsPsych.init()`.
The ITI can also be controlled at the trial level through the `post_trial_gap` parameter. Setting this parameter to a positive integer *x* will cause a blank screen to display after the trial for *x* milliseconds. Setting this parameter for a trial will override the `default_iti` value set in `jsPsych.init`.
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: 'There will be a 1.5 second blank screen after this trial.',
post_trial_gap: 1500
}
```
### The on_start parameter
Immediately before a trial runs, there is an opportunity to run an arbitrary function through the `on_start` event handler. This event handler is passed a single argument containing an *editable* copy of the trial parameters. This function can therefore be used to alter the trial based on the state of the experiment, among other uses.
```javascript
// when this trial runs, the on_start function will change the trial's stimulus and data parameters,
// so the trial will display an incongruent Flanker stimulus with a right-facing central arrow
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
},
on_start: function(trial){
trial.stimulus = '<<><<';
trial.data.stimulus_type = 'incongruent';
trial.data.target_direction = 'right';
}
}
```
### The on_finish parameter
After a trial is completed, there is an opportunity to run an arbitrary function through the `on_finish` event handler. This function is passed a single argument containing an *editable* copy of the data recorded for that trial. This function can therefore be used to update the state of the experiment based on the data collected, or modify the data collected.
The `on_finish` function can be useful to calculate new data properties that were unknowable at the start of the trial. For example, with the Flanker Task example above, the `on_finish` function could check the response and use to this information to add a new property to the data called `correct`, which is either `true` or `false`.
```javascript
// in addition to all of the standard data collected for this trial,
// this on_finish function adds a property called 'correct'
// which is either 'true' or 'false'
// depending on the response that was made
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left',
correct_response: 'f'
},
on_finish: function(data){
if(data.key_press == data.correct_response){
data.correct = true;
} else {
data.correct = false;
}
}
}
```
### The on_load parameter
The `on_load` callback function will trigger once the trial has completed loading. For most plugins, this will occur once the display has been initially updated but before any user interactions or timed events (e.g., animations) have occurred. This can be useful for changing various aspects of the page elements and their properties that would otherwise require modifying the plugin file.
```javascript
var trial = {
type: 'image-keyboard-response',
stimulus: 'imgA.png',
on_load: function() {
// this will change the src attribute of the image after 500ms
setTimeout(function(){
document.querySelector('img').src = 'imgB.png'
}, 500);
}
};
```
## Data collected by all plugins
Each plugin defines what data is collected on the trial. The documentation for each plugin specifies what information will be stored in the trial data.
In addition to the data collected by a plugin, there is a default set of data that is collected on every trial.
| Name | Type | Value |
| ---------------- | ------- | ---------------------------------------- |
| trial_type | string | The name of the plugin used to run the trial. |
| trial_index | numeric | The index of the current trial across the whole experiment. |
| time_elapsed | numeric | The number of milliseconds between the start of the experiment and when the trial ended. |
| internal_node_id | string | A string identifier for the current TimelineNode. |
## Creating a new plugin
You can add new kinds of tasks to jsPsych by creating new plugins, or modifying existing plugins. A task can be virtually any kind of activity. If it can be implemented in JavaScript, then it almost certainly can be turned into a jsPsych plugin.
### What's in a plugin file?
Plugin files follow a specific template. Adherence to the template is what allows jsPsych to run a plugin without knowing anything about what the plugin is doing. What makes plugins so flexible is that the template imposes very few requirements on the code. Here's what an empty plugin template looks like:
```js
jsPsych.plugins['plugin-name'] = (function(){
var plugin = {};
plugin.info = {
name: 'plugin-name',
parameters: {
}
}
plugin.trial = function(display_element, trial){
jsPsych.finishTrial();
}
return plugin;
})();
```
This plugin will work! It defines a plugin called 'plugin-name', and it does absolutely nothing. However, it won't break the experiment, and jsPsych will understand that this is a valid plugin.
Let's examine it in more detail.
The overall structure of the plugin is defined using a module JavaScript design pattern. This pattern uses a technique called an anonymous closure. This is why the first line has `(function(){` and the last line is `})();`. The details aren't important, but if you want to learn more about it, [this is a nice overview](http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html). The reason this pattern is useful is because it allows for persistent state and private scope. In other words, the plugin is isolated and can't be altered by other plugins.
The module, created by the `(function(){` `})();` expressions, contains an object called `plugin`. The `plugin` object has two properties: `info` and `trial`. The `plugin` object is returned at the end of the module, which is what assigns the defined properties of `plugin` to `jsPsych['plugin-name']`.
### plugin.info
The plugin's `info` property is an object that contains all of the available parameters for the plugin. Each parameter name is a property, and the value is an object that includes a description of the parameter, the value's type (string, integer, etc.), and the default value. See some of the plugin files in the jsPsych plugins folder for examples.
jsPsych allows most [plugin parameters to be dynamic](dynamic-parameters.md), which means that the parameter value can be a function that will be evaluated right before the trial starts. However, if you want your plugin to have a parameter that is a function that _shouldn't_ be evaluated before the trial starts, then you should make sure that the parameter type is `'FUNCTION'`. This tells jsPsych not to evaluate the function as it normally does for dynamic parameters. See the `canvas-*` plugins for examples.
### plugin.trial
The plugin's `trial` property is a function that runs a single trial. There are two parameters that are passed into the trial method. The first, `display_element`, is the DOM element where jsPsych content is being rendered. This parameter will be an `HTMLElement`. Generally, you don't need to worry about this parameter being in the correct format, and can assume that it is an `HMTLElement` and use methods of that class. The second, `trial`, is an object containing all of the parameters specified in the corresponding TimelineNode. If you have specified all of your parameters in `plugin.info`, along with default values for each one, then the `trial` object will contain the default values for any parameters that were not specified in the trial's definition.
The only requirement for the `trial` method is that it calls `jsPsych.finishTrial()` when it is done. This is how jsPsych knows to advance to the next trial in the experiment (or end the experiment if it is the last trial). The plugin can do whatever it needs to do before that point.
Of course, there are other things that you will probably want the plugin to do inside the `plugin.trial` function, besides just end. Here are some examples:
### Changing the content of the display
There are a few ways to change the content of the display. The `display_element` parameter of the trial method contains the DOM element for displaying content, so you can use various JavaScript methods for interaction with the display element. A common one is to change the `innerHTML`.
```javascript
var html_content = '<p>This is the first paragraph</p>';
html_content += '<p>This is the second paragraph</p>';
display_element.innerHTML = html_content;
```
jsPsych doesn't clear the display before or after each trial, so it is often appropriate to use `innerHTML` to clear the display at the end of a trial:
```javascript
// clear the display
display_element.innerHTML = '';
```
### Writing data
Plugins exist to collect data, so saving data is obviously a crucial thing to do. You can pass an object of data as the parameter to `jsPsych.finishTrial()`:
```javascript
var data = {
correct: true,
rt: 350
}
jsPsych.finishTrial(data);
```
The data recorded will be that `correct` is `true` and that `rt` is `350`. Additional data for the trial will also be collected automatically by the jsPsych library.
### The plugin template
An empty plugin template is included in the `plugins/template` folder.

View File

@ -185,24 +185,6 @@ var face_name_procedure = {
} }
``` ```
### Repeating trials
If we want to repeat the set of trials multiple times, then we can set `repetitions` to an integer. If `randomize_order` is also `true`, the order will re-randomize before every repetition.
```javascript
var face_name_procedure = {
// timeline parameter hidden to save space ...
timeline_variables: [
{ face: 'person-1.jpg', name: 'Alex' },
{ face: 'person-2.jpg', name: 'Beth' },
{ face: 'person-3.jpg', name: 'Chad' },
{ face: 'person-4.jpg', name: 'Dave' }
],
randomize_order: true,
repetitions: 3
}
```
### Sampling methods ### Sampling methods
There are also a set of sampling methods that can be used to select a set of trials from the timeline_variables. Sampling is declared by creating a `sample` parameter. The `sample` parameter is given an object of arguments. The `type` parameter in this object controls the type of sampling that is done. Valid values for `type` are There are also a set of sampling methods that can be used to select a set of trials from the timeline_variables. Sampling is declared by creating a `sample` parameter. The `sample` parameter is given an object of arguments. The `type` parameter in this object controls the type of sampling that is done. Valid values for `type` are
@ -325,9 +307,41 @@ var face_name_procedure = {
} }
``` ```
## Repeating a set of trials
To repeat a timeline multiple times, you can create an object (node) that contains a `timeline`, which is the timeline array to repeat, and `repetitions`, which is the number of times to repeat that timeline.
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: 'This trial will be repeated twice.'
}
var node = {
timeline: [trial],
repetitions: 2
}
```
The `repetitions` parameter can be used alongside other node parameters, such as timeline variables, loop functions, and/or conditional functions. If you are using `timeline_variables` and `randomize_order` is `true`, then the order of the timeline variables will re-randomize before every repetition.
```javascript
var face_name_procedure = {
// timeline parameter hidden to save space ...
timeline_variables: [
{ face: 'person-1.jpg', name: 'Alex' },
{ face: 'person-2.jpg', name: 'Beth' },
{ face: 'person-3.jpg', name: 'Chad' },
{ face: 'person-4.jpg', name: 'Dave' }
],
randomize_order: true,
repetitions: 3
}
```
## Looping timelines ## Looping timelines
Any timeline can be looped using the `loop_function` option. The loop function should be a function that evaluates to `true` if the timeline should repeat, and `false` if the timeline should end. It receives a single parameter: the DataCollection object with all of the data from the trials executed in the last iteration of the timeline. The loop function will be evaluated after the timeline is completed. Any timeline can be looped using the `loop_function` option. The loop function should be a function that evaluates to `true` if the timeline should repeat, and `false` if the timeline should end. It receives a single parameter, named `data` by convention. This parameter will be the [DataCollection object](/core_library/jspsych-data/#datacollection) with all of the data from the trials executed in the last iteration of the timeline. The loop function will be evaluated after the timeline is completed.
```javascript ```javascript
var trial = { var trial = {

View File

@ -1,213 +0,0 @@
# Advanced Options for Trials
The parameters available for a trial depend primarily on what plugin is used for the trial. However, there are several options that do not depend on the particular plugin; they are available for all trials.
## The data parameter
The `data` parameter enables tagging the trial with additional properties. This can be useful for storing properties of the trial that are not directly apparent from the values that the plugin records. The `data` parameter value should be an object that contains key-value pairs.
A simple example is the [Flanker Task](https://en.wikipedia.org/wiki/Eriksen_flanker_task). In this experiment, participants respond to the direction of an arrow, pressing a key to the left for a left-pointing arrow (<) and a key to the right for a right-pointing arrow (>). The arrow appears in the center of *flankers*, or arrows that the participant should ignore. Those flankers can be congruent (>>>>>) or incongruent (<<><<).
A trial for the Flanker Task written with jsPsych might look like this:
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
}
}
```
Note the use of the data parameter to add a property `stimulus_type` with the value `congruent` and a property `target_direction` with the value `left`. Having these properties recorded directly in the data simplifies data analysis, making it easy to aggregate data by `stimulus_type` and/or `target_direction`.
## Inter-trial interval
The default inter-trial interval (ITI) in jsPsych is 0 ms. This can be adjusted at the experiment-wide level by changing the `default_iti` parameter in `jsPsych.init()`.
The ITI can also be controlled at the trial level through the `post_trial_gap` parameter. Setting this parameter to a positive integer *x* will cause a blank screen to display after the trial for *x* milliseconds.
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: 'There will be a 1.5 second blank screen after this trial.',
post_trial_gap: 1500
}
```
## The on_start event
Immediately before a trial runs, there is an opportunity to run an arbitrary function through the `on_start` event handler. This event handler is passed a single argument containing an *editable* copy of the trial parameters. This event handler can therefore be used to alter the trial based on the state of the experiment, among other uses.
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
},
on_start: function(trial){
trial.stimulus = '<<><<';
trial.data.stimulus_type = 'incongruent';
}
}
```
## The on_finish event
After a trial is completed, there is an opportunity to run an arbitrary function through the `on_finish` event handler. This event handler is passed a single argument containing an *editable* copy of the data recorded for that trial. This event handler can therefore be used to update the state of the experiment based on the data collected or modify the data collected.
This can be useful to calculate new data properties that were unknowable at the start of the trial. For example, with the Flanker Task example above, the `on_finish` event could add a new property `correct`.
```javascript
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
},
on_finish: function(data){
if(data.key_press == "f"){
data.correct = true; // can add property correct by modify data object directly
} else {
data.correct = false;
}
}
}
```
## The on_load event
The `on_load` callback can be added to any trial. The callback will trigger once the trial has completed loading. For most plugins, this will occur once the display has been initially updated but before any user interactions or timed events (e.g., animations) have occurred.
#### Sample use
```javascript
var trial = {
type: 'image-keyboard-response',
stimulus: 'imgA.png',
on_load: function() {
console.log('The trial just finished loading.');
}
};
```
## Dynamic parameters
Most trial parameters can be functions. In a typical declaration of a jsPsych trial, parameters have to be known at the start of the experiment. This makes it impossible to alter the content of the trial based on the outcome of previous trials. When functions are used as the parameter value, the function is evaluated at the start of the trial, and the return value of the function is used as the parameter for that trial. This enables dynamic updating of the parameter based on data that a subject has generated or any other information that you may not know in advance.
Here is a sketch of how this functionality could be used to display feedback to a subject in the Flanker Task.
```javascript
var timeline = [];
var trial = {
type: 'html-keyboard-response',
stimulus: '<<<<<',
choices: ['f','j'],
data: {
stimulus_type: 'congruent',
target_direction: 'left'
},
on_finish: function(data){
if(data.key_press == "f"){
data.correct = true; // can add the property "correct" to the trial data by modifying the data object directly
} else {
data.correct = false;
}
}
}
var feedback = {
type: 'html-keyboard-response',
stimulus: function(){
// determine what the stimulus should be for this trial based on the accuracy of the last response
var last_trial_correct = jsPsych.data.get().last(1).values()[0].correct;
if(last_trial_correct){
return "<p>Correct!</p>";
} else {
return "<p>Wrong.</p>"
}
}
}
timeline.push(trial, feedback);
```
The trial's `data` parameter can be also function, which is useful for when you want to save information to the data that can change during the experiment. For example, if you have a global variable called `current_difficulty` that tracks the difficulty level in an adaptive task, you can save the current value of this variable to the trial data like this:
```js
var current_difficulty; // value changes during the experiment
var trial = {
type: 'survey-text',
questions: [{prompt: "Please enter your response."}]
data: function() {
return {difficulty: current_difficulty};
}
}
```
It's also possible to use a function for just a single parameter in the trial's `data` object, for instance if you want to combine static and dynamic information in the data:
```js
var trial = {
type: 'survey-text',
questions: [{prompt: "Please enter your response."}]
data: {
difficulty: function() {
return current_difficulty; // this value changes during the experiment
},
task_part: 'recall', // this part of the trial data is always the same
block_number: 1
}
}
```
Dyanmic parameters work the same way with nested parameters, which are parameters that contain one or more sets of other parameters. For instance, many survey-* plugins have a `questions` parameter that is a nested parameter: it is an array that contains the parameters for one or more questions on the page. To make the `questions` parameter dynamic, you can use a function that returns the array with all of the parameters for each question:
```js
var subject_id; // value is set during the experiment
var trial = {
type: 'survey-text',
questions: function(){
return [ {prompt: "Hi "+subject_id+"! What's your favorite city?", required: true, name: 'fav_city'} ];
}
}
```
You can also use a function for any of the individual parameters inside of a nested parameter.
```js
var trial = {
type: 'survey-text',
questions: [
{
prompt: function() {
// this question prompt is dynamic -
// the text that is shown will change based on the participant's earlier response
var favorite_city = JSON.parse(jsPsych.data.getLastTrialData().values()[0].responses).fav_city;
var text = "Earlier you said your favorite city is "+favorite_city+". What do you like most about "+favorite_city+"?"
return text;
},
required: true,
rows: 40,
columns: 10
},
{
prompt: 'This is the second question the page. This one is not dynamic.'
}
]
}
```
Note that if the plugin *expects* the value of a given parameter to be a function, then this function *will not* be evaluated at the start of the trial. This is because some plugins allow the researcher to specify functions that should be called at some point during the trial. Some examples of this include the `stimulus` parameter in the canvas-* plugins, the `mistake_fn` parameter in the cloze plugin, and the `stim_function` parameter in the reconstruction plugin. If you want to check whether this is the case for a particular plugin and parameter, then the parameter's `type` in the `plugin.info` section of the plugin file. If the parameter type is `jsPsych.plugins.parameterType.FUNCTION`, then this parameter must be a function and it will not be executed before the trial starts.

View File

@ -1,79 +0,0 @@
# Creating a new plugin
Creating new plugins is the way to add new kinds of tasks to jsPsych. A task can be virtually any kind of activity. If it can be implemented in JavaScript, then it almost certainly can be turned into a plugin.
## What's in a plugin file?
Plugin files follow a specific template. Adherence to the template is what allows jsPsych to run a plugin without knowing anything about what the plugin is doing. What makes plugins so flexible is that the template imposes very few requirements on the code. Here's what an empty plugin template looks like:
```
jsPsych.plugins['plugin-name'] = (function(){
var plugin = {};
plugin.info = {
name: 'plugin-name',
parameters: {
}
}
plugin.trial = function(display_element, trial){
jsPsych.finishTrial();
}
return plugin;
})();
```
This plugin will work! It defines a plugin called 'plugin-name', and it does absolutely nothing. However, it won't break the experiment, and jsPsych will understand that this is a valid plugin.
Let's examine it in more detail.
The overall structure of the plugin is defined using a module JavaScript design pattern. This pattern uses a technique called an anonymous closure. This is why the first line has `(function(){` and the last line is `})();`. The details aren't important, but if you want to learn more about it, [this is a nice overview](http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html). The reason this pattern is useful is because it allows for persistent state and private scope. In other words, the plugin is isolated and can't be altered by other plugins.
The module, created by the `(function(){` `})();` expressions, contains an object called `plugin` that has two properties, `info` and `trial`. The `plugin` object is returned at the end of the module, which is what assigns the defined properties of `plugin` to `jsPsych['plugin-name']`.
### plugin.trial
The `trial` method is responsible for running a single trial. There are two parameters that are passed into the trial method. The first, `display_element`, is the DOM element where jsPsych content is being rendered. This parameter will be an `HTMLElement`. Generally, you don't need to worry about this parameter being in the correct format, and can assume that it is an `HMTLElement` and use methods of that class. The second, `trial`, is an object containing all of the parameters specified in the corresponding TimelineNode.
The only requirement for the `trial` method is that it calls `jsPsych.finishTrial()` when it is done. This is how jsPsych knows to advance to the next trial in the experiment (or end the experiment if it is the last trial). The plugin can do whatever it needs to do before that point.
Of course, there are other things that you will probably want the plugin to do besides just end. Here are some examples:
#### Change the content of the display
There are a few ways to change the content of the display. The `display_element` parameter of the trial method contains the DOM element for displaying content, so you can use various JavaScript methods for interaction with the display element. A common one is to change the `innerHTML`.
```javascript
var html_content = '<p>This is the first paragraph</p>';
html_content += '<p>This is the second paragraph</p>';
display_element.innerHTML = html_content;
```
It is often appropriate to use `innerHTML` to clear the display at the end of a trial:
```javascript
// clear the display
display_element.innerHTML = '';
```
#### Write data
Plugins exist to collect data, so saving data is obviously a crucial thing to do. You can pass an object of data as the parameter to `jsPsych.finishTrial()`:
```javascript
var data = {
correct: true,
rt: 350
}
jsPsych.finishTrial(data)
```
The data recorded will be that `correct` is `true` and that `rt` is `350`. Additional data for the trial will also be collected automatically by the jsPsych library.
## The plugin template
An empty plugin template is included in the `plugins/template` folder.

View File

@ -4,7 +4,7 @@ This plugin displays a sequence of images at a fixed frame rate. The sequence ca
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -18,7 +18,7 @@ render_on_canvas | boolean | true | If true, the images will be drawn onto a can
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -10,7 +10,7 @@ The trial can end when the subject responds, when the audio file has finished pl
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------------ | ---------------- | ---------------------------------------- | ---------------------------------------- | | ------------------------------ | ---------------- | ---------------------------------------- | ---------------------------------------- |
@ -27,7 +27,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| -------------- | ------- | ---------------------------------------- | | -------------- | ------- | ---------------------------------------- |

View File

@ -10,7 +10,7 @@ The trial can end when the subject responds, when the audio file has finished pl
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------------ | ---------------- | ------------------ | ---------------------------------------- | | ------------------------------ | ---------------- | ------------------ | ---------------------------------------- |
@ -24,7 +24,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |

View File

@ -10,7 +10,7 @@ The trial can end when the subject responds, or if the subject has failed to res
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------------ | ---------------- | ------------- | ---------------------------------------- | | ------------------------------ | ---------------- | ------------- | ---------------------------------------- |
@ -30,7 +30,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ------------ | ------- | ---------------------------------------- | | ------------ | ------- | ---------------------------------------- |

View File

@ -6,7 +6,7 @@ The function cannot take any arguments. If arguments are needed, then an anonymo
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -16,7 +16,7 @@ async | boolean | `false` | Set to true if `func` is an asynchoronous function.
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin can be used to draw a stimulus on a [HTML canvas element](https://ww
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -21,7 +21,7 @@ response_ends_trial | boolean | true | If true, then the trial will end whenever
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin can be used to draw a stimulus on a [HTML canvas element](https://ww
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------- | ---------------- | ------------------ | ---------------------------------------- | | ------------------- | ---------------- | ------------------ | ---------------------------------------- |
@ -18,7 +18,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ This plugin can be used to draw a stimulus on a [HTML canvas element](https://ww
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -25,7 +25,7 @@ response_ends_trial | boolean | true | If true, then the trial will end whenever
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The categorize animation plugin shows a sequence of images at a specified frame
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------------ | ---------------- | ------------------ | ---------------------------------------- | | ------------------------------ | ---------------- | ------------------ | ---------------------------------------- |
@ -23,7 +23,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The categorize html plugin shows an HTML object on the screen. The subject respo
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------------------- | ---------------- | ------------------------ | ---------------------------------------- | | -------------------------- | ---------------- | ------------------------ | ---------------------------------------- |
@ -25,7 +25,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The categorize image plugin shows an image object on the screen. The subject res
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------------------- | ---------------- | ------------------------ | ---------------------------------------- | | -------------------------- | ---------------- | ------------------------ | ---------------------------------------- |
@ -26,12 +26,12 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| stimulus | string | Either the path to the image file or the string containing the HTML formatted content that the subject saw on this trial. | | stimulus | string | Either the path to the image file or the string containing the HTML formatted content that the subject saw on this trial. |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| correct | boolean | `true` if the subject got the correct answer, `false` otherwise. | | correct | boolean | `true` if the subject got the correct answer, `false` otherwise. |

View File

@ -4,7 +4,7 @@ This plugin displays a text with certain words removed. Participants are asked t
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------- | -------- | ------------------ | ---------------------------------------- | | ------------- | -------- | ------------------ | ---------------------------------------- |
@ -15,7 +15,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ------- | ---------------- | --------------------------- | | ------- | ---------------- | --------------------------- |

View File

@ -4,7 +4,7 @@ The HTML plugin displays an external HTML document (often a consent form). Eithe
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------- | -------- | ---------------------------- | ---------------------------------------- | | -------------- | -------- | ---------------------------- | ---------------------------------------- |
@ -17,7 +17,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ---- | ------- | ---------------------------------------- | | ---- | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The free-sort plugin displays one or more images on the screen that the particip
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -28,7 +28,7 @@ stim_starts_inside | boolean | false | If `false`, the images will be positioned
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -6,7 +6,7 @@ Safari does not support keyboard input when the browser is in fullscreen mode. T
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -17,7 +17,7 @@ delay_after | numeric | 1000 | The length of time to delay after entering fullsc
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin displays HTML content and records responses generated by button clic
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -20,7 +20,7 @@ response_ends_trial | boolean | true | If true, then the trial will end whenever
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -5,7 +5,7 @@ This plugin displays HTML content and records responses generated with the keybo
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------- | ---------------- | ------------------ | ---------------------------------------- | | ------------------- | ---------------- | ------------------ | ---------------------------------------- |
@ -18,11 +18,11 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| stimulus | string | The HTML content that was displayed on the screen. | | stimulus | string | The HTML content that was displayed on the screen. |

View File

@ -4,7 +4,7 @@ This plugin displays HTML content and allows the subject to respond by dragging
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -24,7 +24,7 @@ response_ends_trial | boolean | true | If true, then the trial will end whenever
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin runs a single trial of the [implicit association test (IAT)](https:/
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ----------------------- | ---------------- | ---------------------------------------- | ---------------------------------------- | | ----------------------- | ---------------- | ---------------------------------------- | ---------------------------------------- |
@ -24,12 +24,12 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| stimulus | string | Either the path to the image file or the string containing the HTML-formatted content that the subject saw on this trial. | | stimulus | string | Either the path to the image file or the string containing the HTML-formatted content that the subject saw on this trial. |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| correct | boolean | Boolean indicating whether the user's key press was correct or incorrect for the given stimulus. | | correct | boolean | Boolean indicating whether the user's key press was correct or incorrect for the given stimulus. |

View File

@ -4,7 +4,7 @@ This plugin runs a single trial of the [implicit association test (IAT)](https:/
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ----------------------- | ------------------- | ---------------------------------------- | ---------------------------------------- | | ----------------------- | ------------------- | ---------------------------------------- | ---------------------------------------- |
@ -13,8 +13,8 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
| bottom_instructions | string | `<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>` | Instructions about making a wrong key press and whether another key press is needed to continue. | | bottom_instructions | string | `<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>` | Instructions about making a wrong key press and whether another key press is needed to continue. |
| force_correct_key_press | boolean | false | If this is `true` and the user presses the wrong key then they have to press the other key to continue. An example would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key 'i' was pressed, then pressing 'e' is needed to continue the trial. When this is `true`, then parameter `key_to_move_forward` is not used. | | force_correct_key_press | boolean | false | If this is `true` and the user presses the wrong key then they have to press the other key to continue. An example would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key 'i' was pressed, then pressing 'e' is needed to continue the trial. When this is `true`, then parameter `key_to_move_forward` is not used. |
| display_feedback | boolean | false | If `true`, then `image_when_wrong` and `wrong_image_name` are required. If `false`, `trial_duration` is needed and trial will continue automatically. | | display_feedback | boolean | false | If `true`, then `image_when_wrong` and `wrong_image_name` are required. If `false`, `trial_duration` is needed and trial will continue automatically. |
| left_category_key | string | 'E' | Key press that is associated with the `left_category_label`. | | left_category_key | string | 'e' | Key press that is associated with the `left_category_label`. |
| right_category_key | string | 'I' | Key press that is associated with the `right_category_label`. | | right_category_key | string | 'i' | Key press that is associated with the `right_category_label`. |
| left_category_label | string | ['left'] | An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the left side of the page. | | left_category_label | string | ['left'] | An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the left side of the page. |
| right_category_label | string | ['right'] | An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the right side of the page. | | right_category_label | string | ['right'] | An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the right side of the page. |
| stim_key_association | string | 'undefined' | Either 'left' or 'right'. This indicates whether the stimulus is associated with the key press and category on the left or right side of the page (`left_category_key` or `right_category_key`). | | stim_key_association | string | 'undefined' | Either 'left' or 'right'. This indicates whether the stimulus is associated with the key press and category on the left or right side of the page (`left_category_key` or `right_category_key`). |
@ -24,12 +24,12 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| stimulus | string | Either the path to the image file or the string containing the HTML-formatted content that the subject saw on this trial. | | stimulus | string | Either the path to the image file or the string containing the HTML-formatted content that the subject saw on this trial. |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| correct | boolean | Boolean indicating whether the user's key press was correct or incorrect for the given image. | | correct | boolean | Boolean indicating whether the user's key press was correct or incorrect for the given image. |

View File

@ -6,7 +6,7 @@ Image files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -26,7 +26,7 @@ render_on_canvas | boolean | true | If true, the image will be drawn onto a canv
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -6,7 +6,7 @@ Image files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| --------------------- | ---------------- | ------------------ | ---------------------------------------- | | --------------------- | ---------------- | ------------------ | ---------------------------------------- |
@ -23,11 +23,11 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| stimulus | string | The path of the image that was displayed. | | stimulus | string | The path of the image that was displayed. |

View File

@ -6,7 +6,7 @@ Image files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -30,7 +30,7 @@ render_on_canvas | boolean | true | If true, the image will be drawn onto a canv
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin is for showing instructions to the subject. It allows subjects to na
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| --------------------- | ------- | ------------- | ---------------------------------------- | | --------------------- | ------- | ------------- | ---------------------------------------- |
@ -21,7 +21,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ------------ | ----------- | ---------------------------------------- | | ------------ | ----------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The maxdiff plugin displays a table with rows of alternatives to be selected for
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -18,7 +18,7 @@ button_label | string | 'Continue' | Label of the button.
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -9,7 +9,7 @@ For optimal performance, fullscreen mode should be manually triggered by the use
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Descripton | | Parameter | Type | Default Value | Descripton |
| ------------------------ | ---------------- | -------------------- | ---------------------------------------- | | ------------------------ | ---------------- | -------------------- | ---------------------------------------- |
@ -59,7 +59,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects all parameter data described above and the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects all parameter data described above and the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ---------------- | ----------- | ---------------------------------------- | | ---------------- | ----------- | ---------------------------------------- |

View File

@ -6,7 +6,7 @@ The stimulus must be defined through a function that returns an HTML-formatted s
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -19,7 +19,7 @@ button_label | string | 'Continue' | The text that appears on the button to fini
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ This plugin displays a resizable div container that allows the user to drag unti
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -17,7 +17,7 @@ starting_size | numeric | 100 | The initial size of the box, in pixels, along th
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The same-different-html plugin displays two stimuli sequentially. Stimuli are HT
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------------- | ------- | ------------- | ---------------------------------------- | | -------------------- | ------- | ------------- | ---------------------------------------- |
@ -20,7 +20,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The same-different plugin displays two stimuli sequentially. Stimuli are image o
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------------- | ------- | ------------- | ---------------------------------------- | | -------------------- | ------- | ------------- | ---------------------------------------- |
@ -20,7 +20,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
@ -45,9 +45,9 @@ Additionally, if `first_stim_duration` is null, then the following data is also
var block = { var block = {
type: 'same-different-image', type: 'same-different-image',
stimuli: ['img/happy_face_1.jpg', 'img/sad_face_3.jpg'], stimuli: ['img/happy_face_1.jpg', 'img/sad_face_3.jpg'],
prompt: "<p>Press S if the faces had the same emotional expression. Press D if the faces had different emotional expressions.</p>", prompt: "<p>Press s if the faces had the same emotional expression. Press d if the faces had different emotional expressions.</p>",
same_key: 'S', same_key: 's',
different_key: 'D', different_key: 'd',
answer: 'different' answer: 'different'
} }
``` ```
@ -58,9 +58,9 @@ var block = {
var block = { var block = {
type: 'same-different-image', type: 'same-different-image',
stimuli: ['img/happy_face_1.jpg', 'img/happy_face_3.jpg'], stimuli: ['img/happy_face_1.jpg', 'img/happy_face_3.jpg'],
prompt: "<p>Press S if the faces had the same emotional expression. Press D if the faces had different emotional expressions.</p>", prompt: "<p>Press s if the faces had the same emotional expression. Press d if the faces had different emotional expressions.</p>",
same_key: 'S', same_key: 's',
different_key: 'D', different_key: 'd',
answer: 'same' answer: 'same'
} }
``` ```

View File

@ -4,7 +4,7 @@ The serial reaction time mouse plugin implements a generalized version of the SR
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------- | -------------- | ------------- | ---------------------------------------- | | ------------------------- | -------------- | ------------- | ---------------------------------------- |
@ -21,7 +21,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| ------ | ------- | ---------------------------------------- | | ------ | ------- | ---------------------------------------- |

View File

@ -4,7 +4,7 @@ The serial reaction time plugin implements a generalized version of the SRT task
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ---------------------- | ---------------- | --------------------- | ---------------------------------------- | | ---------------------- | ---------------- | --------------------- | ---------------------------------------- |
@ -23,13 +23,13 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| grid | JSON | A JSON-encoded representation of the grid. | | grid | JSON | A JSON-encoded representation of the grid. |
| target | JSON | A JSON-encoded representation of the target on the grid. | | target | JSON | A JSON-encoded representation of the target on the grid. |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the second stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the second stimulus first appears on the screen until the subject's response. |
| correct | boolean | `true` if the subject's response matched the target. | | correct | boolean | `true` if the subject's response matched the target. |

View File

@ -4,7 +4,7 @@ The survey-html-form plugin displays a set of `<inputs>` from a HTML string. The
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -17,7 +17,7 @@ autocomplete | boolean | false | This determines whether or not all of the input
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The survey-likert plugin displays a set of questions with Likert scale responses
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -17,7 +17,7 @@ autocomplete | boolean | false | This determines whether or not all of the input
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The survey-multi-choice plugin displays a set of questions with multiple choice
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -16,7 +16,7 @@ autocomplete | boolean | false | This determines whether or not all of the input
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The survey-multi-select plugin displays a set of questions with multiple select
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -17,7 +17,7 @@ autocomplete | boolean | false | This determines whether or not all of the input
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -4,7 +4,7 @@ The survey-text plugin displays a set of questions with free response text field
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -16,7 +16,7 @@ autocomplete | boolean | false | This determines whether or not all of the input
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -6,7 +6,7 @@ Video files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -31,7 +31,7 @@ response_allowed_while_playing | boolean | true | If true, then responses are al
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -6,7 +6,7 @@ Video files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------------------ | ---------------- | ----------------------- | ---------------------------------------- | | ------------------------------ | ---------------- | ----------------------- | ---------------------------------------- |
@ -27,11 +27,11 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ------- | ---------------------------------------- | | --------- | ------- | ---------------------------------------- |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| stimulus | string | JSON encoding of the `stimulus` array. | | stimulus | string | JSON encoding of the `stimulus` array. |

View File

@ -6,7 +6,7 @@ Video files can be automatically preloaded by jsPsych using the [`preload` plugi
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description Parameter | Type | Default Value | Description
----------|------|---------------|------------ ----------|------|---------------|------------
@ -35,7 +35,7 @@ response_allowed_while_playing | boolean | true | If true, then responses are al
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value Name | Type | Value
-----|------|------ -----|------|------

View File

@ -6,7 +6,7 @@ This plugin presents a customizable visual-search task modelled after [Wang, Cav
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| ------------------ | --------------- | ------------- | ---------------------------------------- | | ------------------ | --------------- | ------------- | ---------------------------------------- |
@ -25,12 +25,12 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| -------------- | ----------- | ---------------------------------------- | | -------------- | ----------- | ---------------------------------------- |
| correct | boolean | True if the subject gave the correct response. | | correct | boolean | True if the subject gave the correct response. |
| key_press | numeric | Indicates which key the subject pressed. | | key_press | string | Indicates which key the subject pressed. |
| rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. | | rt | numeric | The response time in milliseconds for the subject to make a response. The time is measured from when the stimulus first appears on the screen until the subject's response. |
| set_size | numeric | The number of items in the search array | | set_size | numeric | The number of items in the search array |
| target_present | boolean | True if the target is present in the search array | | target_present | boolean | True if the target is present in the search array |

View File

@ -10,7 +10,7 @@ This plugin requires the Snap.svg library, available at [http://www.snapsvg.io](
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| --------------------- | ---------------- | ------------------ | ---------------------------------------- | | --------------------- | ---------------- | ------------------ | ---------------------------------------- |
@ -25,7 +25,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| --------- | ----------- | ---------------------------------------- | | --------- | ----------- | ---------------------------------------- |

View File

@ -6,7 +6,7 @@ Fiser, J., & Aslin, R. N. (2001). Unsupervised statistical learning of higher-or
## Parameters ## Parameters
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable. In addition to the [parameters available in all plugins](/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description | | Parameter | Type | Default Value | Description |
| -------------- | ------- | ------------- | ---------------------------------------- | | -------------- | ------- | ------------- | ---------------------------------------- |
@ -16,7 +16,7 @@ In addition to the [parameters available in all plugins](overview.md#parameters-
## Data Generated ## Data Generated
In addition to the [default data collected by all plugins](overview.md#data-collected-by-plugins), this plugin collects the following data for each trial. In addition to the [default data collected by all plugins](/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial.
| Name | Type | Value | | Name | Type | Value |
| -------- | ----------- | ---------------------------------------- | | -------- | ----------- | ---------------------------------------- |

View File

@ -34,7 +34,8 @@ nav:
- 'Video Tutorials': 'tutorials/video-tutorials.md' - 'Video Tutorials': 'tutorials/video-tutorials.md'
- Overview: - Overview:
- 'Creating an Experiment: The Timeline': 'overview/timeline.md' - 'Creating an Experiment: The Timeline': 'overview/timeline.md'
- 'Advanced Options for Trials': 'overview/trial.md' - 'Plugins': 'overview/plugins.md'
- 'Dynamic Parameters': 'overview/dynamic-parameters.md'
- 'Controlling Visual Appearance': 'overview/style.md' - 'Controlling Visual Appearance': 'overview/style.md'
- 'Data Storage, Aggregation, and Manipulation': 'overview/data.md' - 'Data Storage, Aggregation, and Manipulation': 'overview/data.md'
- 'Running Experiments': 'overview/running-experiments.md' - 'Running Experiments': 'overview/running-experiments.md'
@ -55,8 +56,6 @@ nav:
- 'jsPsych.turk': 'core_library/jspsych-turk.md' - 'jsPsych.turk': 'core_library/jspsych-turk.md'
- 'jsPsych.pluginAPI': 'core_library/jspsych-pluginAPI.md' - 'jsPsych.pluginAPI': 'core_library/jspsych-pluginAPI.md'
- Plugins: - Plugins:
- 'Overview': 'plugins/overview.md'
- 'Creating a New Plugin': 'plugins/creating-a-plugin.md'
- 'jspsych-animation': 'plugins/jspsych-animation.md' - 'jspsych-animation': 'plugins/jspsych-animation.md'
- 'jspsych-audio-button-response': 'plugins/jspsych-audio-button-response.md' - 'jspsych-audio-button-response': 'plugins/jspsych-audio-button-response.md'
- 'jspsych-audio-keyboard-response': 'plugins/jspsych-audio-keyboard-response.md' - 'jspsych-audio-keyboard-response': 'plugins/jspsych-audio-keyboard-response.md'

View File

@ -52,8 +52,8 @@ describe('#getKeyboardResponse', function(){
}) })
jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback, valid_responses: jsPsych.NO_KEYS}); jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback, valid_responses: jsPsych.NO_KEYS});
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 54})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 'a'}));
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 54})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 'a'}));
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 'a'})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 'a'}));
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 'a'})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 'a'}));
@ -215,8 +215,8 @@ describe('#cancelKeyboardResponse', function(){
var listener = jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback}); var listener = jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback});
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
jsPsych.pluginAPI.cancelKeyboardResponse(listener); jsPsych.pluginAPI.cancelKeyboardResponse(listener);
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 'q'}));
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 'q'}));
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
}); });
}); });
@ -235,8 +235,8 @@ describe('#cancelAllKeyboardResponses', function(){
jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback}); jsPsych.pluginAPI.getKeyboardResponse({callback_function: callback});
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
jsPsych.pluginAPI.cancelAllKeyboardResponses(); jsPsych.pluginAPI.cancelAllKeyboardResponses();
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {key: 'q'}));
document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {key: 'q'}));
expect(callback.mock.calls.length).toBe(0); expect(callback.mock.calls.length).toBe(0);
}); });
}); });