function AfterResponse(info) {

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

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

      // only record the first response
      if (response.key == null) {
        response = info;
      }

      // assign response variables
      if (jsPsych.pluginAPI.compareKeys(trial.left_key, response.key)){
        response.choice = 'left';
        response.chosen_image = display.left_image;
        response.ur_chosen_image = trial.left_image;
        display.left_box = "selected";
      } else if (jsPsych.pluginAPI.compareKeys(trial.right_key, response.key)){
        response.choice = 'right';
        response.chosen_image = display.right_image;
        response.ur_chosen_image = trial.right_image;
        display.right_box = "selected";
      }

      // update the screen with the pressed key
      DrawScreen(ctx);

      // set a timeout to display the feedback after a given delay
      jsPsych.pluginAPI.setTimeout(function() {
        DisplayFeedback();
      }, trial.choice_display_duration);

    }
// function to handle responses by the subject
function to handle responses by the subject
function to handle responses by the subject
function AfterResponse(info) {
      jsPsych.pluginAPI.cancelAllKeyboardResponses();
      jsPsych.pluginAPI.clearAllTimeouts();
      if (response.key == null) {
        response = info;
      }
      if (jsPsych.pluginAPI.compareKeys(trial.left_key, response.key)){
        response.choice = 'left';
        response.chosen_image = display.left_image;
        response.ur_chosen_image = trial.left_image;
        display.left_box = "selected";
      } else if (jsPsych.pluginAPI.compareKeys(trial.right_key, response.key)){
        response.choice = 'right';
        response.chosen_image = display.right_image;
        response.ur_chosen_image = trial.right_image;
        display.right_box = "selected";
      }
      DrawScreen(ctx);
      jsPsych.pluginAPI.setTimeout(function() {
        DisplayFeedback();
      }, trial.choice_display_duration);
    }
function AfterResponse ( info ) { jsPsych . pluginAPI . cancelAllKeyboardResponses ( ) ; jsPsych . pluginAPI . clearAllTimeouts ( ) ; if ( response . key == null ) { response = info ; } if ( jsPsych . pluginAPI . compareKeys ( trial . left_key , response . key ) ) { response . choice = 'left' ; response . chosen_image = display . left_image ; response . ur_chosen_image = trial . left_image ; display . left_box = "selected" ; } else if ( jsPsych . pluginAPI . compareKeys ( trial . right_key , response . key ) ) { response . choice = 'right' ; response . chosen_image = display . right_image ; response . ur_chosen_image = trial . right_image ; display . right_box = "selected" ; } DrawScreen ( ctx ) ; jsPsych . pluginAPI . setTimeout ( function ( ) { DisplayFeedback ( ) ; } , trial . choice_display_duration ) ; }
function to handle responses by the subject
function to handle responses by the subject
// clear keyboard listener // kill any remaining setTimeout handlers // only record the first response // assign response variables // update the screen with the pressed key // set a timeout to display the feedback after a given delay