psychopy.org | Reference | Downloads | Github

Is there some type of guide for installing the PsychoJS library to the right location - and then importing it into a .html file?

Whenever learning a new language I don’t have that much issue with learning the new rules, syntax, etc. but always struggle with knowing how to set things up, such as downloading libraries to the right location, importing them, and so forth.

In particular I was wondering in which directory the PsychoJS library should be placed, and also how to import it into a .html and .js file so that I can practice coding using some aspects of the library? I have tried browsing information on downloading and importing external libraries in Javascript but still can’t work out how to do this.

2 Likes

Hi,

Is there a reason why you wnat to use JSpsych rather than PsychoPy builder (which has an auto translate as of January 2020 meaning that I once again avoid having to learn Javascript).

If you do go down that route I’d recommend looking at my crib sheet. https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit?usp=sharing

Best wishes,

Wakefield

I would also recommend using Builder to create your online studies. PsychoJS tries to mirror the PsychoPy API as much as possible, so code you write in Python does not need to change too much to work in PsychoJS. The crib sheet in the link above helps with the translation process if you are having issues translating code components from Builder.

However, if you want a working local copy of the PsychoJS libs because you want to see the code, or maybe even change it to see how things work, you can use the local debugging mode from the Runner (globe with bug icon). After you have created your Pavlovia project, clicking the local debug mode will download the PsychoJS libs into your projects HTML folder, so you can run your online task from a locally served browser.