psychopy.org | Reference | Downloads | Github

Javascript experiment

Hi there,
I have two experiments that run on JATOS - they just use javascript, jQuery and some other javascript libraries, but not jsPsych or labJS. With a new ethics, we’re now meant to use Pavlovia instead. Is it possible to integrate this kind of experiment with Pavlovia? In the documentation, I’ve only seen info for jsPsych and labJS.
I’d be very grateful for any pointers where I can find more information.
Jacquie

I second that. Some suggestions and pointers would be very appreciated!
Thanks!

I’m now messaging the jsPsych toolbox creators (on their github) to see whether it’s maybe possible to use jsPsych. Because in JATOS, there is a very simple code which for submitting your data: data can be in any javascript format and then it’s given to JATOS. I’m wondering whether it’s possible to also pass data in this way to jsPsych even if the task has not been run with jsPsych.

Here is the link: From JATOS to Pavlovia with jsPsych? · Issue #2457 · jspsych/jsPsych · GitHub

Hello @JacquieS and @Dejan_Draschkow ,

Would you have a sample experiment I could look at? It is usually no problem to incorporate a third-party JavaScript library into a PsychoJS experiment, for it to run on pavlovia.org and indeed many people do it routinely.
Best wishes,

Alain

Which part of the script(s) would be useful? It’s a very long script … Here is what seems to me the crucial lines that submit code to JATOS (JATOS does nothing else in my experiment [or rather it does a small thing - randomising schedules- , but it will be easy to take that out]):

I have a structure called ‘data’ that throughout the experiment, I store data in. Below are just some examples what is stored in the structure. Then the data is usually ‘stringified’ and then send to JATOS. I’m wondering whether it might be possible to leave everything about the experiment the same and (after initialising PsychoJS of course), submit the data via PsychoJS?

data.exptDate.endExpt = new Date();
data.exptDate.experimentDuration = data.exptDate.endExpt.getTime() - data.exptDate.startExpt.getTime();
data.exptDate.numberMcqAttempts = tSet.mcq.attemptCounter;
data.behaviorLongFormat=tSet.behaviorLongFormat;
var resultJson = JSON.stringify(data);
jatos.submitResultData(resultJson)