To follow up, it’s possible in principle using the PsychoJS library, which you have access to anyway if you’re running the experiment on Pavlovia. You might need to reference the psychoJS source code in your header, e.g.,
<script src="lib/psychojs-2024.2.2.js"></script>
but if you do that you should just be able to use the code in Wakefield’s example to interact with the shelf without further modification.
Thanks for the info @wakecarter and @jonathan.kominsky , I was not aware that you could still use the psychojs module within a jsPsych experiment. I will try it out and keep you updated!
Hi Christophe, I have the same issue. Did you manage to get wakecarter and jonathan’s suggestions to work?
I have included
<script src="lib/psychojs-2024.2.2.js"></script>
in my header but I get error “Uncaught ReferenceError: PsychoJS is not defined” when I try to create a psychoJS object at the top of my JSpsych experiment file,
const psychoJS = new PsychoJS({
debug: true, // Set to false for production
});
No we were not able to solve it yet. We reduced it to a minimal version where in addition to having the jsPsych scripts, we only add the script tag that you are referring to, but are not referencing the PsychoJS module in our code.
Your code you posted in your reply was going to be my next step but that is dispiriting to hear you couldn’t import the psychojs module. I will try a minimal example myself and post an update if I find a solution.
Incidentally did you solve your jsPsych-Pavlovia server side variable issue using another method? I would like a participant counter variable to balance conditions for small pilot studies.