mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
change key_press to response in docs and examples
This commit is contained in:
parent
85e3d6d5bb
commit
4fbfe94e4c
@ -205,7 +205,7 @@ var block = {
|
|||||||
choices: ['y', 'n'],
|
choices: ['y', 'n'],
|
||||||
prompt: '<p>Press "y" to Continue. Press "n" to end this node of the experiment.</p>',
|
prompt: '<p>Press "y" to Continue. Press "n" to end this node of the experiment.</p>',
|
||||||
on_finish: function(data) {
|
on_finish: function(data) {
|
||||||
if (data.key_press == 'n') {
|
if (data.response == 'n') {
|
||||||
jsPsych.endCurrentTimeline();
|
jsPsych.endCurrentTimeline();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -258,7 +258,7 @@ var trial = {
|
|||||||
choices: ['y', 'n']
|
choices: ['y', 'n']
|
||||||
prompt: '<p>Press "y" to Continue. Press "n" to end the experiment</p>',
|
prompt: '<p>Press "y" to Continue. Press "n" to end the experiment</p>',
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.key_press == "n"){
|
if(data.response == "n"){
|
||||||
jsPsych.endExperiment('The experiment was ended by pressing "n".');
|
jsPsych.endExperiment('The experiment was ended by pressing "n".');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ var trial = {
|
|||||||
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
||||||
choices: ['p','c'],
|
choices: ['p','c'],
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.key_press == "p") {
|
if(data.response == "p") {
|
||||||
jsPsych.pauseExperiment();
|
jsPsych.pauseExperiment();
|
||||||
setTimeout(jsPsych.resumeExperiment, 30000);
|
setTimeout(jsPsych.resumeExperiment, 30000);
|
||||||
}
|
}
|
||||||
@ -535,7 +535,7 @@ var trial = {
|
|||||||
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
stimulus: 'Press p to take a 30 second break. Otherwise, press c to continue immediately.',
|
||||||
choices: ['p','c'],
|
choices: ['p','c'],
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.key_press == "p") {
|
if(data.response == "p") {
|
||||||
jsPsych.pauseExperiment();
|
jsPsych.pauseExperiment();
|
||||||
setTimeout(jsPsych.resumeExperiment, 30000);
|
setTimeout(jsPsych.resumeExperiment, 30000);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ var trial = {
|
|||||||
type: 'image-keyboard-response',
|
type: 'image-keyboard-response',
|
||||||
stimulus: 'imgA.png',
|
stimulus: 'imgA.png',
|
||||||
on_finish: function(data) {
|
on_finish: function(data) {
|
||||||
if(data.key_press == 'j'){
|
if(data.response == 'j'){
|
||||||
data.correct = true;
|
data.correct = true;
|
||||||
} else {
|
} else {
|
||||||
data.correct = false;
|
data.correct = false;
|
||||||
|
@ -61,7 +61,7 @@ var trial = {
|
|||||||
type: 'image-keyboard-response',
|
type: 'image-keyboard-response',
|
||||||
stimulus: 'imgA.jpg',
|
stimulus: 'imgA.jpg',
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.key_press == 'j'){
|
if(data.response == 'j'){
|
||||||
data.correct = true;
|
data.correct = true;
|
||||||
} else {
|
} else {
|
||||||
data.correct = false;
|
data.correct = false;
|
||||||
|
@ -22,7 +22,7 @@ var trial = {
|
|||||||
},
|
},
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
// Score the response as correct or incorrect.
|
// Score the response as correct or incorrect.
|
||||||
if(data.key_press == "f"){
|
if(data.response == "f"){
|
||||||
data.correct = true;
|
data.correct = true;
|
||||||
} else {
|
} else {
|
||||||
data.correct = false;
|
data.correct = false;
|
||||||
|
@ -196,7 +196,7 @@ Below is example data from the image-keyboard-response trial taken from the expe
|
|||||||
{
|
{
|
||||||
"rt": null,
|
"rt": null,
|
||||||
"stimulus": "img/blue.png",
|
"stimulus": "img/blue.png",
|
||||||
"key_press": null,
|
"response": null,
|
||||||
"trial_type": "image-keyboard-response",
|
"trial_type": "image-keyboard-response",
|
||||||
"trial_index": 4,
|
"trial_index": 4,
|
||||||
"time_elapsed": 30701,
|
"time_elapsed": 30701,
|
||||||
|
@ -132,7 +132,7 @@ var trial = {
|
|||||||
correct_response: 'f'
|
correct_response: 'f'
|
||||||
},
|
},
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.key_press == data.correct_response){
|
if(data.response == data.correct_response){
|
||||||
data.correct = true;
|
data.correct = true;
|
||||||
} else {
|
} else {
|
||||||
data.correct = false;
|
data.correct = false;
|
||||||
|
@ -352,7 +352,7 @@ var trial = {
|
|||||||
var loop_node = {
|
var loop_node = {
|
||||||
timeline: [trial],
|
timeline: [trial],
|
||||||
loop_function: function(data){
|
loop_function: function(data){
|
||||||
if(data.values()[0].key_press == 'r'){
|
if(data.values()[0].response == 'r'){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -382,7 +382,7 @@ var if_node = {
|
|||||||
// get the data from the previous trial,
|
// get the data from the previous trial,
|
||||||
// and check which key was pressed
|
// and check which key was pressed
|
||||||
var data = jsPsych.data.get().last(1).values()[0];
|
var data = jsPsych.data.get().last(1).values()[0];
|
||||||
if(data.key_press == 's'){
|
if(data.response == 's'){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
var loop_node = {
|
var loop_node = {
|
||||||
timeline: [trial],
|
timeline: [trial],
|
||||||
loop_function: function(data){
|
loop_function: function(data){
|
||||||
if(data.values()[0].key_press == 'r'){
|
if(data.values()[0].response == 'r'){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -40,7 +40,7 @@
|
|||||||
timeline: [if_trial],
|
timeline: [if_trial],
|
||||||
conditional_function: function(){
|
conditional_function: function(){
|
||||||
var data = jsPsych.data.get().last(1).values()[0];
|
var data = jsPsych.data.get().last(1).values()[0];
|
||||||
if(data.key_press == 's'){
|
if(data.response == 's'){
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -61,9 +61,9 @@
|
|||||||
data: jsPsych.timelineVariable('data'),
|
data: jsPsych.timelineVariable('data'),
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
var correct = false;
|
var correct = false;
|
||||||
if(data.direction == 'left' && data.key_press == 'ArrowLeft' && data.rt > -1){
|
if(data.direction == 'left' && data.response == 'ArrowLeft' && data.rt > -1){
|
||||||
correct = true;
|
correct = true;
|
||||||
} else if(data.direction == 'right' && data.key_press == 'ArrowRight' && data.rt > -1){
|
} else if(data.direction == 'right' && data.response == 'ArrowRight' && data.rt > -1){
|
||||||
correct = true;
|
correct = true;
|
||||||
}
|
}
|
||||||
data.correct = correct;
|
data.correct = correct;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
render_on_canvas: false,
|
render_on_canvas: false,
|
||||||
prompt: '<p>Press "y" to continue. Press "n" to end this node of the experiment.</p>',
|
prompt: '<p>Press "y" to continue. Press "n" to end this node of the experiment.</p>',
|
||||||
on_finish: function(data) {
|
on_finish: function(data) {
|
||||||
if (data.key_press == "n") {
|
if (data.response == "n") {
|
||||||
jsPsych.endCurrentTimeline();
|
jsPsych.endCurrentTimeline();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
prompt: '<p>Press "y" to continue. Press "n" to end the experiment.</p>',
|
prompt: '<p>Press "y" to continue. Press "n" to end the experiment.</p>',
|
||||||
render_on_canvas: false,
|
render_on_canvas: false,
|
||||||
on_finish: function(data) {
|
on_finish: function(data) {
|
||||||
if (data.key_press == 'n') {
|
if (data.response == 'n') {
|
||||||
jsPsych.endExperiment('The experiment was ended. This is the end message.');
|
jsPsych.endExperiment('The experiment was ended. This is the end message.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -90,9 +90,9 @@
|
|||||||
},
|
},
|
||||||
on_finish: function(data){
|
on_finish: function(data){
|
||||||
if(data.word_validity == 'valid'){
|
if(data.word_validity == 'valid'){
|
||||||
var correct = data.key_press == 'y';
|
var correct = data.response == 'y';
|
||||||
} else {
|
} else {
|
||||||
var correct = data.key_press == 'n';
|
var correct = data.response == 'n';
|
||||||
}
|
}
|
||||||
data.correct = correct;
|
data.correct = correct;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user