JATOS and jsPsych with jatos.batchSession
Hi!
I am attempting to integrate jsPsych and JATOS, and I'd like to use jatos.batchSession to rotate subjects. If I do something like this (this is a toy example), I get an error "No open batch channel":
What's the best way to solve this so that I can use the contents of the batchSession in building my timeline? Should I move the 'jatos.onLoad' line to encompass the entire script, or is there a reason it's only placed at the end where you run the jsPsych timeline?
Many thanks!
Comments
Hi,
The batch session exists only after JATOS initializes.
It should work if you declare the two variables batchSession and version as globals (there were they are), but only assign them values within jatos.onLoad.
Let me know if this doesn't work!
Elisa
Hi Elisa,
Thanks for this reply!
So if I implement something like this:
The issue is that "number" remains undefined when it is used in line 19. The solution I've found to this is to place everything within the callback function of 'jatos.onLoad' like so:
Are there any issues with this? Should this perhaps be the preferred way to integrate jsPsych into JATOS, or is the example on this page generally superior?
Your solution, wrapping everything in jatos.onLoad is perfectly fine. The one from the example is just the most simple one.
Best,
Kristian