function EndTrial() {

      // clear keyboard listener
      jsPsych.pluginAPI.cancelAllKeyboardResponses();

      // kill any remaining setTimeout handlers
      jsPsych.pluginAPI.clearAllTimeouts();

      // gather the data to store for the trial
      var trial_data = {
        'choice_type': trial.choice_type,
        'block': counter.block,
        'trial': counter.trial,
        'left_image': display.left_image,
        'right_image': display.right_image,
        'ur_left_image': trial.left_image,
        'ur_right_image': trial.right_image,
        'chosen_image': response.chosen_image,
        'ur_chosen_image': response.ur_chosen_image,
        'rt': response.rt,
        'key_char': response.key_char,
        'choice': response.choice,
        'feedback': response.feedback
      };

      // increment the trial counter
      counter.trial += 1;

      // move on to the next trial
      jsPsych.finishTrial(trial_data);

    }
// function to end trial when it is time
function to end trial when it is time
function to end trial when it is time
function EndTrial() {
      jsPsych.pluginAPI.cancelAllKeyboardResponses();
      jsPsych.pluginAPI.clearAllTimeouts();
      var trial_data = {
        'choice_type': trial.choice_type,
        'block': counter.block,
        'trial': counter.trial,
        'left_image': display.left_image,
        'right_image': display.right_image,
        'ur_left_image': trial.left_image,
        'ur_right_image': trial.right_image,
        'chosen_image': response.chosen_image,
        'ur_chosen_image': response.ur_chosen_image,
        'rt': response.rt,
        'key_char': response.key_char,
        'choice': response.choice,
        'feedback': response.feedback
      };
      counter.trial += 1;
      jsPsych.finishTrial(trial_data);
    }
function EndTrial ( ) { jsPsych . pluginAPI . cancelAllKeyboardResponses ( ) ; jsPsych . pluginAPI . clearAllTimeouts ( ) ; var trial_data = { 'choice_type' : trial . choice_type , 'block' : counter . block , 'trial' : counter . trial , 'left_image' : display . left_image , 'right_image' : display . right_image , 'ur_left_image' : trial . left_image , 'ur_right_image' : trial . right_image , 'chosen_image' : response . chosen_image , 'ur_chosen_image' : response . ur_chosen_image , 'rt' : response . rt , 'key_char' : response . key_char , 'choice' : response . choice , 'feedback' : response . feedback } ; counter . trial += 1 ; jsPsych . finishTrial ( trial_data ) ; }
function to end trial when it is time
function to end trial when it is time
// clear keyboard listener // kill any remaining setTimeout handlers // gather the data to store for the trial // increment the trial counter // move on to the next trial