Replies: 1 comment 6 replies
-
Hi @noah10, Thinking about what could be going on here... Could you try this? var alertCallback = function(info){
alert('You pressed key '+info.key+' after '+info.rt+' ms');
}
var t = {
type: 'html-keyboard-response',
stimulus: 'foo',
choices: ['q'],
on_load: function(){
jsPsych.pluginAPI.getKeyboardResponse({callback_function: alertCallback});
}
response_ends_trial: false
};
jsPsych.init({
timeline: [t]
}); If that fixes it then I suspect what is happening is that there is an This will be fixed in |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a very simple setup (pulled from the documentation and the test code):
...yet my alertCallback function is never called (in either Safari or Chrome, both on OS X), no matter whether I press 'q' or another key. Stepping through it in the debugger I can watch my callback function get added to jsPsych.pluginAPI.keyboard_listeners and then see the html-keyboard-response plugin callback function get added. Unfortunately when the html-keyboard-response callback function is added keyboard_listeners is empty, suggesting that somehow it (or jsPysch.pluginAPI) has been re-initialized since my alertCallback was added.
Any thoughts on what might be going wrong here? I suspect that perhaps it's something wonky with webpack and jsPsych not playing well together, but I haven't been able to pin anything down.
Beta Was this translation helpful? Give feedback.
All reactions