mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +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'],
|
||||
prompt: '<p>Press "y" to Continue. Press "n" to end this node of the experiment.</p>',
|
||||
on_finish: function(data) {
|
||||
if (data.key_press == 'n') {
|
||||
if (data.response == 'n') {
|
||||
jsPsych.endCurrentTimeline();
|
||||
}
|
||||
},
|
||||
@ -258,7 +258,7 @@ var trial = {
|
||||
choices: ['y', 'n']
|
||||
prompt: '<p>Press "y" to Continue. Press "n" to end the experiment</p>',
|
||||
on_finish: function(data){
|
||||
if(data.key_press == "n"){
|
||||
if(data.response == "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.',
|
||||
choices: ['p','c'],
|
||||
on_finish: function(data){
|
||||
if(data.key_press == "p") {
|
||||
if(data.response == "p") {
|
||||
jsPsych.pauseExperiment();
|
||||
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.',
|
||||
choices: ['p','c'],
|
||||
on_finish: function(data){
|
||||
if(data.key_press == "p") {
|
||||
if(data.response == "p") {
|
||||
jsPsych.pauseExperiment();
|
||||
setTimeout(jsPsych.resumeExperiment, 30000);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ var trial = {
|
||||
type: 'image-keyboard-response',
|
||||
stimulus: 'imgA.png',
|
||||
on_finish: function(data) {
|
||||
if(data.key_press == 'j'){
|
||||
if(data.response == 'j'){
|
||||
data.correct = true;
|
||||
} else {
|
||||
data.correct = false;
|
||||
|
@ -61,7 +61,7 @@ var trial = {
|
||||
type: 'image-keyboard-response',
|
||||
stimulus: 'imgA.jpg',
|
||||
on_finish: function(data){
|
||||
if(data.key_press == 'j'){
|
||||
if(data.response == 'j'){
|
||||
data.correct = true;
|
||||
} else {
|
||||
data.correct = false;
|
||||
|
@ -22,7 +22,7 @@ var trial = {
|
||||
},
|
||||
on_finish: function(data){
|
||||
// Score the response as correct or incorrect.
|
||||
if(data.key_press == "f"){
|
||||
if(data.response == "f"){
|
||||
data.correct = true;
|
||||
} else {
|
||||
data.correct = false;
|
||||
|
@ -196,7 +196,7 @@ Below is example data from the image-keyboard-response trial taken from the expe
|
||||
{
|
||||
"rt": null,
|
||||
"stimulus": "img/blue.png",
|
||||
"key_press": null,
|
||||
"response": null,
|
||||
"trial_type": "image-keyboard-response",
|
||||
"trial_index": 4,
|
||||
"time_elapsed": 30701,
|
||||
|
@ -132,7 +132,7 @@ var trial = {
|
||||
correct_response: 'f'
|
||||
},
|
||||
on_finish: function(data){
|
||||
if(data.key_press == data.correct_response){
|
||||
if(data.response == data.correct_response){
|
||||
data.correct = true;
|
||||
} else {
|
||||
data.correct = false;
|
||||
|
@ -352,7 +352,7 @@ var trial = {
|
||||
var loop_node = {
|
||||
timeline: [trial],
|
||||
loop_function: function(data){
|
||||
if(data.values()[0].key_press == 'r'){
|
||||
if(data.values()[0].response == 'r'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -382,7 +382,7 @@ var if_node = {
|
||||
// get the data from the previous trial,
|
||||
// and check which key was pressed
|
||||
var data = jsPsych.data.get().last(1).values()[0];
|
||||
if(data.key_press == 's'){
|
||||
if(data.response == 's'){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -17,7 +17,7 @@
|
||||
var loop_node = {
|
||||
timeline: [trial],
|
||||
loop_function: function(data){
|
||||
if(data.values()[0].key_press == 'r'){
|
||||
if(data.values()[0].response == 'r'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -40,7 +40,7 @@
|
||||
timeline: [if_trial],
|
||||
conditional_function: function(){
|
||||
var data = jsPsych.data.get().last(1).values()[0];
|
||||
if(data.key_press == 's'){
|
||||
if(data.response == 's'){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -61,9 +61,9 @@
|
||||
data: jsPsych.timelineVariable('data'),
|
||||
on_finish: function(data){
|
||||
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;
|
||||
} 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;
|
||||
}
|
||||
data.correct = correct;
|
||||
|
@ -24,7 +24,7 @@
|
||||
render_on_canvas: false,
|
||||
prompt: '<p>Press "y" to continue. Press "n" to end this node of the experiment.</p>',
|
||||
on_finish: function(data) {
|
||||
if (data.key_press == "n") {
|
||||
if (data.response == "n") {
|
||||
jsPsych.endCurrentTimeline();
|
||||
}
|
||||
},
|
||||
|
@ -28,7 +28,7 @@
|
||||
prompt: '<p>Press "y" to continue. Press "n" to end the experiment.</p>',
|
||||
render_on_canvas: false,
|
||||
on_finish: function(data) {
|
||||
if (data.key_press == 'n') {
|
||||
if (data.response == 'n') {
|
||||
jsPsych.endExperiment('The experiment was ended. This is the end message.');
|
||||
}
|
||||
},
|
||||
|
@ -90,9 +90,9 @@
|
||||
},
|
||||
on_finish: function(data){
|
||||
if(data.word_validity == 'valid'){
|
||||
var correct = data.key_press == 'y';
|
||||
var correct = data.response == 'y';
|
||||
} else {
|
||||
var correct = data.key_press == 'n';
|
||||
var correct = data.response == 'n';
|
||||
}
|
||||
data.correct = correct;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user