Skip to content

getting trial_duration into the data for a trial (a question from the RT task tutorial) #808

Discussion options

You must be logged in to vote

Hi Carolyn,

You're right -- this is not a straightforward value to access. I'm hoping to improve the data handling in the future so that any trial parameters can be optionally added onto the data object for a trial.

There are a couple workarounds. One is to assign this value to a global variable, and then add it in the on_finish callback.

var fixation_timing = null; // create global variable
var trial = {
  type: 'html-keyboard-response',
  stimulus: '<div style="font-size:60px;">+</div>',
  choices: jsPsych.NO_KEYS,
  trial_duration: function(){
    // no var keyword means that it will assign to the global we created outside the trial definition
    fixation_timing = jsPsych.randomization.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CarolynBuck-Gengler
Comment options

Answer selected by CarolynBuck-Gengler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants