Closed lawero closed 3 years ago
Thank you for using my plugin!
Please see this web page. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Whitespace_keys
To specify the space key, you need to write as follows:
if (event.key === ' ')
I also find this writing style confusing.
One more thing, I recommend you to use performance.now() instead of Date.now() for precise times.
One more thing, I recommend you to use performance.now() instead of Date.now() for precise times.
thx! already done. it was a first messy attempt to make a workaround.
Thank you for using my plugin!
Please see this web page. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Whitespace_keys
To specify the space key, you need to write as follows:
if (event.key === ' ')
I also find this writing style confusing.
thank you for your plugin!
1.space key: of course. I'm feeling a little bit stupid.
2.confusing style:
what do you mean precisely? The boolean was a failing tentative and jsPsych.data.addProperties
was wrong too. But I was (and I am) looking for a way to activate the event handler only for a specific trial where I need to obtain how much time the subject press a button of the keyboard.
Given that, yes...I'm not very structurated.
Again thanks for all 👍
Dear @lawero
I don't know if I'm understanding your question correctly, but the following links might be useful.
https://github.com/jspsych/jsPsych/issues/492 https://stackoverflow.com/questions/30795525/performance-now-vs-date-now
thank you for all! PS: I think the problem of the event listener is inside the function end_trial... the trial.key_up_func is always null here so it's never removed (and of course it has been added)
thank you for all! PS: I think the problem of the event listener is inside the function end_trial... the trial.key_up_func is always null here so it's never removed (and of course it has been added)
I found my problem: I'm using the function finishTrial that skip your function end_trial :)
(Thanks in advance) I'm trying to use the keyboard event handler to record the duration of the keypress of "space". My idea is very simple (here a explanatory piece of code):
The problem is that if I write
event.key==='space'
it doesnt work. And i try a lot of variations. Here the demo "keyboard_event.html" with the same change (and it doesn't work too)