Replies: 1 comment
-
Hi @rpan001, yes, jsPsych 6.3.0+ uses the keyboard event's You could get jsPsych to distinguish between left and right shift, but it might be a little tricky. One option is to modify the Another option is to set up your own var trial_data = {
rt: null,
key: null
};
var start_time = performance.now();
document.addEventListener('keydown', function(e) {
// check if the response is valid
if (trial.choices == jsPsych.ALL_KEYS || trial.choices.includes(e.code)) {
// if so, then store the key press and RT
trial_data.rt = performance.now() - start_time;
trial_data.key = e.code;
// might want to do other stuff here, like call the end_trial function if necessary
}
}); I hope this helps. Feel free to follow up if you need further guidance. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was looking into jspsych.js and saw that there was only one keycode value for shift, 16, which covered both the left and right shift and I was wondering if there was any way possible to have jspsych distinguish between the two.
I found this relevant stackoverflow post, but I'm unsure where in the code or how to implement it. Any help is appreciated.
[https://stackoverflow.com/questions/22029033/can-javascript-tell-the-difference-between-left-and-right-shift-key]
Beta Was this translation helpful? Give feedback.
All reactions