This is an updated example of the integration between PsiTurk and jsPsych. It is a rewrite of the example code given in the jsPsych tutorial using Literate CoffeeScript. It uses some code used in jodeleeuw's experiment example (also available on GitHub).
For a breakdown of how the experiment works, see the Literate CoffeeScript file, or, if you prefer, see the compiled javascript.
The experiment file templates/exp.html
calls the static/js/experiment.js
experiment.
See the PsiTurk Quick Start Guide for info on how to get up and running quickly. Instead of using psiturk-setup-example
to create example code, you can check out this repository.
git clone --recursive https://github.com/jtth/jspsi-go-example.git
You can use git clone https://github.com/jtth/jspsi-go-example.git
and symlink your own local copy of jsPsych if you'd prefer.
Or just grab it using the PsiTurk Experiment Exchange.
psiturk-install NiyHgcEBwwH7uQebC2oWPN
Once you have the directory on your computer, go into it and start PsiTurk.
cd jspsi-go-example
psiturk
If you want to edit the CoffeeScript experiment and have it installed, run this in the directory with experiment.litcoffee
to automatically recompile the script into javascript every time you save.
coffee -c -w experiment.litcoffee
All of this is available under an MIT license. If you like this and want more examples in CoffeScript, consider leaving a tip through PayPal or through Cash.