A template for building browser experiments with:
jsPsych 8+ official pluginsjspsych-builder- optional
@kurokida/jspsych-psychophysics
- Install dependencies:
npm install
- Start development server:
npm start
- Build for non-JATOS platforms:
npm run build
- Export for JATOS platform:
npm run jatos
src/experiment.ts- Main entry point that builds the timeline and runs
jsPsych.
- Main entry point that builds the timeline and runs
src/settings.ts- Central configuration (
CONSENT, timings, keys, condition settings, run flags).
- Central configuration (
src/jsp.tsinitJsPsych(...)setup, finish behavior, data handling, redirect logic.
src/instructions/- Welcome/consent/fullscreen/browser-check and instruction-related timeline pieces.
src/text/- Localized text dictionaries and translation helpers.
src/trials/- Trial template structure (
stimuli,layout,trial,builders).
- Trial template structure (
src/lib/general/- Shared general functions (CSS, consent checks, timers, interaction checks).
src/lib/color/- Reusable color-generation/conversion functions.
src/lib/response/- Reusable response/scoring/validation functions.
assets/- Static files (images, external consent/notice HTML).
- Update study-level settings in
src/settings.ts. - Edit consent/notice text in:
src/text/consent.tsassets/external-html/consent-*.html
- Edit participant-facing UI strings in
src/text/*. - Add/modify instruction screens in
src/instructions/*. - Implement your trial logic in
src/trials/*(template stubs are provided). - Wire timeline order in
src/experiment.ts.
RUN_PROLIFICcontrols whether completion flow redirects to Prolific.- Consent participant ID label switches automatically:
Prolific-IDwhenRUN_PROLIFIC = trueParticipant-IDwhenRUN_PROLIFIC = false