remove uncessary true argument from jsPsych.timelineVariable in examples/tests #883

This commit is contained in:
Becky Gilbert 2021-01-13 10:08:38 -08:00
parent a496871984
commit 5c653f4bde
4 changed files with 11 additions and 11 deletions

View File

@ -67,12 +67,12 @@
}; };
// to use the canvas stimulus function with timeline variables, // to use the canvas stimulus function with timeline variables,
// use the jsPsych.timelineVariable() function inside your stimulus function with the second 'true' argument // the jsPsych.timelineVariable() function can be used inside your stimulus function
var circle_procedure = { var circle_procedure = {
timeline: [{ timeline: [{
type: 'canvas-button-response', type: 'canvas-button-response',
stimulus: function(c) { stimulus: function(c) {
filledCirc(c, jsPsych.timelineVariable('radius', true), jsPsych.timelineVariable('color', true)); filledCirc(c, jsPsych.timelineVariable('radius'), jsPsych.timelineVariable('color'));
}, },
choices: ['Red', 'Green', 'Blue'], choices: ['Red', 'Green', 'Blue'],
prompt: '<p>What color is the circle?</p>', prompt: '<p>What color is the circle?</p>',

View File

@ -41,19 +41,19 @@
} }
// to use the canvas stimulus function with timeline variables, // to use the canvas stimulus function with timeline variables,
// use the jsPsych.timelineVariable() function inside your stimulus function with the second 'true' argument // the jsPsych.timelineVariable() function can be used inside your stimulus function
var trial_procedure = { var trial_procedure = {
timeline: [{ timeline: [{
type: 'canvas-keyboard-response', type: 'canvas-keyboard-response',
stimulus: function(c) { stimulus: function(c) {
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
ctx.beginPath(); ctx.beginPath();
ctx.fillStyle = jsPsych.timelineVariable('color', true); ctx.fillStyle = jsPsych.timelineVariable('color');
ctx.fillRect( ctx.fillRect(
jsPsych.timelineVariable('upper_left_x', true), jsPsych.timelineVariable('upper_left_x'),
jsPsych.timelineVariable('upper_left_y', true), jsPsych.timelineVariable('upper_left_y'),
jsPsych.timelineVariable('width', true), jsPsych.timelineVariable('width'),
jsPsych.timelineVariable('height', true) jsPsych.timelineVariable('height')
); );
ctx.stroke(); ctx.stroke();
}, },

View File

@ -79,7 +79,7 @@
}, },
{ {
type: 'html-keyboard-response', type: 'html-keyboard-response',
stimulus: function(){ return "<p class='stimulus'>"+jsPsych.timelineVariable('word', true)+"</p>"; }, stimulus: function(){ return "<p class='stimulus'>"+jsPsych.timelineVariable('word')+"</p>"; },
choices: ['y','n'], choices: ['y','n'],
post_trial_gap: 0, post_trial_gap: 0,
data: { data: {

View File

@ -125,7 +125,7 @@ describe('loop function', function(){
stimulus: 'foo' stimulus: 'foo'
}], }],
loop_function: function(){ loop_function: function(){
if(jsPsych.timelineVariable('word', true) == 'b' && counter < 2){ if(jsPsych.timelineVariable('word') == 'b' && counter < 2){
counter++; counter++;
return true; return true;
} else { } else {
@ -283,7 +283,7 @@ describe('conditional function', function(){
var innertimeline = { var innertimeline = {
timeline: [trial], timeline: [trial],
conditional_function: function(){ conditional_function: function(){
if(jsPsych.timelineVariable('word', true) == 'b'){ if(jsPsych.timelineVariable('word') == 'b'){
return false; return false;
} else { } else {
return true; return true;