mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 08:38:11 +00:00
parent
9d4d294bad
commit
fb31532071
@ -22,8 +22,6 @@ Adds the timeline to the end of the experiment.
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
#### End the experiment if a particular response is given
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var trial = {
|
var trial = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -350,6 +348,41 @@ var settings = jsPsych.initSettings();
|
|||||||
console.log(JSON.stringify(settings.timeline));
|
console.log(JSON.stringify(settings.timeline));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
## jsPsych.pauseExperiment
|
||||||
|
```
|
||||||
|
jsPsych.pauseExperiment()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Return value
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Pauses the experiment. The experiment will finish the current trial, but will not execute any additional trials until `jsPsych.resumeExperiment()` is called.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var trial = {
|
||||||
|
type: 'single-stim',
|
||||||
|
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
||||||
|
is_html: true,
|
||||||
|
choices: ['p','c'],
|
||||||
|
on_finish: function(data){
|
||||||
|
if(data.key_press == 80) { // 80 = p
|
||||||
|
jsPsych.pauseExperiment();
|
||||||
|
setTimeout(jsPsych.resumeExperiment, 30000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## jsPsych.progress
|
## jsPsych.progress
|
||||||
|
|
||||||
@ -385,6 +418,41 @@ var progress = jsPsych.progress();
|
|||||||
alert('You have completed approximately '+progress.percent_complete+'% of the experiment');
|
alert('You have completed approximately '+progress.percent_complete+'% of the experiment');
|
||||||
|
|
||||||
```
|
```
|
||||||
|
---
|
||||||
|
## jsPsych.resumeExperiment
|
||||||
|
```
|
||||||
|
jsPsych.resumeExperiment()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Return value
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
Resumes the experiment after a call to `jsPsych.pauseExperiment()`. If the post trial delay (`timing_post_trial`) has not yet been reached, then the experiment will not continue until the delay is finished. For example, if `timing_post_trial` was 10,000ms and `jsPsych.resumeExperiment()` was called 6,000ms after the previous trial finished, then the experiment would not continue for another 4,000ms.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var trial = {
|
||||||
|
type: 'single-stim',
|
||||||
|
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
||||||
|
is_html: true,
|
||||||
|
choices: ['p','c'],
|
||||||
|
on_finish: function(data){
|
||||||
|
if(data.key_press == 80) { // 80 = p
|
||||||
|
jsPsych.pauseExperiment();
|
||||||
|
setTimeout(jsPsych.resumeExperiment, 30000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
## jsPsych.startTime
|
## jsPsych.startTime
|
||||||
|
|
||||||
|
@ -14,8 +14,10 @@ Every jsPsych experiment utilizes the core library (contained in the `jspsych.js
|
|||||||
* [jsPsych.finishTrial](jspsych-core.md#jspsychfinishtrial)
|
* [jsPsych.finishTrial](jspsych-core.md#jspsychfinishtrial)
|
||||||
* [jsPsych.getDisplayElement](jspsych-core.md#jspsychgetdisplayelement)
|
* [jsPsych.getDisplayElement](jspsych-core.md#jspsychgetdisplayelement)
|
||||||
* [jsPsych.init](jspsych-core.md#jspsychinit)
|
* [jsPsych.init](jspsych-core.md#jspsychinit)
|
||||||
* [jsPsych.initSettings](jspsych-core.md#jspsychinitSettings)
|
* [jsPsych.initSettings](jspsych-core.md#jspsychinitsettings)
|
||||||
|
* [jsPsych.pauseExperiment](jspsych-core.md#jspsychpauseexperiment)
|
||||||
* [jsPsych.progress](jspsych-core.md#jspsychprogress)
|
* [jsPsych.progress](jspsych-core.md#jspsychprogress)
|
||||||
|
* [jsPsych.resumeExperiment](jspsych-core.md#jspsychresumeexperiment)
|
||||||
* [jsPsych.startTime](jspsych-core.md#jspsychstarttime)
|
* [jsPsych.startTime](jspsych-core.md#jspsychstarttime)
|
||||||
* [jsPsych.totalTime](jspsych-core.md#jspsychtotaltime)
|
* [jsPsych.totalTime](jspsych-core.md#jspsychtotaltime)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user