lab.js
lab.js copied to clipboard
Document code-based integration with JATOS
What would you like or expect to see?
How to export studies into a format that i can upload to JATOS when coding them from scratch
What is currently happening?
No information about it, the documentation just describes how to do it with the builder
Please describe the steps needed to reproduce this phenomenon
const instructions1 = new lab.html.Screen({
title: 'Title',
content: `
<p> ETC </p>
`,
responses: {
'keypress(Enter)': 'response',
},
})
const instructions2 = new lab.html.Screen({})
const instructions3 = new lab.html.Screen({})
const study = new lab.flow.Sequence({
content: [
instructions1,
instructions2,
instructions3
],
events: {
visibilitychange: function (event) {
if (document.hidden) {
alert(`Please don't change windows while the experiment is running`)
}
},
},
})
study.run()
Hi @ZeroPie, and many thanks for your great question! Please be very warmly invited to join our support channel, where there's many more folks around to discuss this kind of question; we try to focus on technical issues here in the repository, and we check quite as often.
As for your question, we haven't documented this process yet, as you noticed -- would you be interested in putting together a short tutorial? My first step would be to look at what the builder does to generate studies for JATOS, and that's two steps if I'm not mistaken:
- First, replace the
study.run()
withjatos.onLoad(() => study.run())
- Second, hook up data storage to the end of the experiment, my adding the following lines to the
study
component:
messageHandlers: {
'epilogue': () => {
var resultJson = study.options.datastore.exportJson();
jatos.submitResultData(resultJson, jatos.startNextComponent)
}
}
Ok, I think with those two steps you should be good to go -- please let me know how things work out, and I'd love to support you in documenting this formally!
Kind regards,
-Felix
Hi Felix,
Thank you for the kind message and for the pointers. I will look into it, get it working and then i willl gladly document the process formally for others.
Thank you for your work and time.
That would be way awesome, thank you so much! Please be warmly invited to ping me if you could use help along the way, I'm always happy to help document things!
Happy experimenting, -Felix