function after_response(choice) {

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

      // measure response time
      var end_time = performance.now();
      var rt = end_time - start_time;

      // store responses.
      response.rt = rt;
      response.choice = parseInt(choice);
      response.accuracy = (trial.correct == response.choice) ? 1 : 0;

      // present feedback
      if ( trial.feedback && response.accuracy == 1 ) {
        display_element.querySelector('#feedback').innerHTML = trial.correct_feedback;
      } else if ( trial.feedback && response.accuracy == 0 ) {
        display_element.querySelector('#feedback').innerHTML = trial.incorrect_feedback;
      }

      // feedback timeout
      jsPsych.pluginAPI.setTimeout(function() {
        end_trial();
      }, trial.feedback ? trial.feedback_duration : 0);

    }
// function to handle responses by the subject

function to handle responses by the subject
function to handle responses by the subject
function after_response(choice) {
      jsPsych.pluginAPI.clearAllTimeouts();
      var end_time = performance.now();
      var rt = end_time - start_time;
      response.rt = rt;
      response.choice = parseInt(choice);
      response.accuracy = (trial.correct == response.choice) ? 1 : 0;
      if ( trial.feedback && response.accuracy == 1 ) {
        display_element.querySelector('#feedback').innerHTML = trial.correct_feedback;
      } else if ( trial.feedback && response.accuracy == 0 ) {
        display_element.querySelector('#feedback').innerHTML = trial.incorrect_feedback;
      }
      jsPsych.pluginAPI.setTimeout(function() {
        end_trial();
      }, trial.feedback ? trial.feedback_duration : 0);
    }
function after_response ( choice ) { jsPsych . pluginAPI . clearAllTimeouts ( ) ; var end_time = performance . now ( ) ; var rt = end_time - start_time ; response . rt = rt ; response . choice = parseInt ( choice ) ; response . accuracy = ( trial . correct == response . choice ) ? 1 : 0 ; if ( trial . feedback && response . accuracy == 1 ) { display_element . querySelector ( '#feedback' ) . innerHTML = trial . correct_feedback ; } else if ( trial . feedback && response . accuracy == 0 ) { display_element . querySelector ( '#feedback' ) . innerHTML = trial . incorrect_feedback ; } jsPsych . pluginAPI . setTimeout ( function ( ) { end_trial ( ) ; } , trial . feedback ? trial . feedback_duration : 0 ) ; }
function to handle responses by the subject
function to handle responses by the subject
// kill any remaining setTimeout handlers
 // measure response time
 // store responses.
 // present feedback
 // feedback timeout
