Skip to content
Discussion options

You must be logged in to vote

In version 6.3 we made a few changes that affect this code:

  1. We standardized the name of the variable containing the user's response on a trial to response. So instead of data.key_press you'll use data.response.
  2. We dropped support for numeric key codes, which are now considered deprecated by web browsers. data.response will be a character string. We recommend using the function jsPsych.pluginAPI.compareKeys(key1, key2) to determine if two values match.

With those changes, your on_finish function should look like this:

on_finish: function(data){
	data.accuracy = jsPsych.pluginAPI.compareKeys(data.correct_response, data.response)
}

Replies: 9 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jodeleeuw
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jodeleeuw
Comment options

Comment options

You must be logged in to vote
1 reply
@becky-gilbert
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants