mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
show list of plugins
This commit is contained in:
parent
969484f0e6
commit
dcca2a47af
@ -6,7 +6,7 @@ The preload trial will end as soon as all files have loaded successfully. The tr
|
|||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
In addition to the [parameters available in all plugins](overview.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. While there are no specific parameters that are required, the plugin expects to be given a set of files to load through one or more of the following parameters: `auto_preload` or `trials` (for automatic loading), and/or `images`, `audio`, `video` (for manual loading). To automatically load files based on a timeline of trials, either set the `auto_preload` parameter is `true` (to load files based on the main timeline passed to `jsPsych.init`) or use the `trials` parameter to load files based on a specific subset of trials. To manually load a set of files, use the `images`, `audio`, and `video` parameters. You can combine automatic and manual loading methods in a single preload trial.
|
In addition to the [parameters available in all plugins](/overview/plugins.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. While there are no specific parameters that are required, the plugin expects to be given a set of files to load through one or more of the following parameters: `auto_preload` or `trials` (for automatic loading), and/or `images`, `audio`, `video` (for manual loading). To automatically load files based on a timeline of trials, either set the `auto_preload` parameter is `true` (to load files based on the main timeline passed to `jsPsych.init`) or use the `trials` parameter to load files based on a specific subset of trials. To manually load a set of files, use the `images`, `audio`, and `video` parameters. You can combine automatic and manual loading methods in a single preload trial.
|
||||||
|
|
||||||
All other parameters can be left unspecified if the default value is acceptable.
|
All other parameters can be left unspecified if the default value is acceptable.
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ All other parameters can be left unspecified if the default value is acceptable.
|
|||||||
|
|
||||||
## 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.md#data-collected-by-plugins), this plugin collects the following data for each trial.
|
||||||
|
|
||||||
| Name | Type | Value |
|
| Name | Type | Value |
|
||||||
| -------------- | ------- | ---------------------------------------- |
|
| -------------- | ------- | ---------------------------------------- |
|
||||||
|
@ -1,69 +1,6 @@
|
|||||||
# Plugins
|
# List of Plugins
|
||||||
|
|
||||||
In jsPsych, plugins define the kinds of tasks that subjects perform in experiments. Some plugins define very general tasks, like displaying instructions or displaying a visual stimulus and getting a keyboard response. Other plugins are more specific, displaying particular kinds of interactive stimuli, or running a specific version of particular kind of task. Creating an experiment with jsPsych involves figuring out which plugins are needed for the kinds of tasks you want to have your subjects perform.
|
These are the plugins that are included in the jsPsych release. If you don't see a plugin that will work for your needs, you can post on [GitHub Discussions](https://github.com/jspsych/jsPsych/discussions) to see if anyone else in the community has an unofficial plugin to share or to get help creating a new plugin. You can also view the [documentation on creating a new plugin](/overview/plugins/#creating-a-new-plugin) or [watch a video tutorial on creating a new plugin](https://www.youtube.com/watch?v=XQcsFwAmbiw&list=PLnfo1lBY1P2Mf_o6rV5wiqqn92Mw3UTGh&index=4).
|
||||||
|
|
||||||
Plugins provide a structure for a particular task, but often allow for significant customization and flexibility. For example, the `jspsych-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 content options have reasonable default values; even though the `jspsych-image-keyboard-response` plugin has many different options, you only *need* to specify the stimulus in order to use it. Each plugin has its own documentation page, which describes what the plugin does and what options are available.
|
|
||||||
|
|
||||||
## Using a plugin
|
|
||||||
|
|
||||||
To use a plugin, you'll need to load the plugin's JavaScript file on your experiment page:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<head>
|
|
||||||
<script src="jspsych/plugins/jspsych-image-keyboard-response.js" type="text/javascript"></script>
|
|
||||||
</head>
|
|
||||||
```
|
|
||||||
|
|
||||||
Once a plugin is loaded, you can define a trial that uses that plugin. The following JavaScript code defines a trial using the `jspsych-image-keyboard-response` plugin to display an image file ('images/happy_face.jpg'). This trial uses the default values for valid keys, length of display, and other parameters. You could override these values by adding them to the object.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var single_stim_trial = {
|
|
||||||
type: 'image-keyboard-response',
|
|
||||||
stimulus: 'images/happy_face.jpg'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Here's an exampe of overriding the default value for `post_trial_gap`:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var single_stim_trial = {
|
|
||||||
type: 'image-keyboard-response',
|
|
||||||
stimulus: 'images/happy_face.jpg',
|
|
||||||
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.
|
|
||||||
|
|
||||||
In addition, there is a set of parameters that can be specified for any plugin.
|
|
||||||
|
|
||||||
Parameter | Type | Default Value | Description
|
|
||||||
----------|------|---------------|------------
|
|
||||||
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_finish | function | `function(){ return; }` | A callback function to execute when the trial finishes. See [this page](../overview/callbacks.md) for more details.
|
|
||||||
on_start | function | `function(){ return; }` | A callback function to execute when the trial begins, before any loading has occurred. See [this 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 [this page](../overview/callbacks.md) for more details.
|
|
||||||
data | object | *undefined* | An object containing additional data to store for the trial. See [this page](../overview/data.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. See jsPsych/examples/css-classes-parameter.html for examples.
|
|
||||||
|
|
||||||
## Data collected by plugins
|
|
||||||
|
|
||||||
Each plugin defines what data is collected on the trial. The documentation for each plugin specifies what data is collected by that plugin.
|
|
||||||
|
|
||||||
In addition to the data collected by a plugin, there is a default set of data that is collected on every trial. The collected data are:
|
|
||||||
|
|
||||||
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 since the start of the experiment when the trial ended.
|
|
||||||
internal_node_id | string | A string identifier for the current TimelineNode.
|
|
||||||
|
|
||||||
## List of available plugins
|
|
||||||
|
|
||||||
This table is a description of all plugins that are distributed with jsPsych. Click on the name of a plugin to view its documentation page.
|
|
||||||
|
|
||||||
Plugin | Description
|
Plugin | Description
|
||||||
------ | -----------
|
------ | -----------
|
@ -56,6 +56,7 @@ 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:
|
||||||
|
- 'List of Plugins': 'plugins/list-of-plugins.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'
|
||||||
|
Loading…
Reference in New Issue
Block a user