Initial commit

This commit is contained in:
2025-07-19 11:10:28 -07:00
commit 544b5d2b1e
15 changed files with 2242 additions and 0 deletions

32
index.js Normal file
View File

@@ -0,0 +1,32 @@
import { initJsPsych } from "jspsych";
import "jspsych/css/jspsych.css";
import "./styles.css";
import { delayed_redirect } from "./utils/helpers.js";
import jsPsychHtmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response";
import { textStimuli } from './scripts/text_stimuli';
const debug = import.meta.env.VITE_DEBUG;
const jsPsych = initJsPsych({
on_finish: function() {
jsPsych.getDisplayElement().innerHTML = textStimuli.complete;
},
on_close: function() {
delayed_redirect(import.meta.env.VITE_CLOSED_URL);
},
on_data_update: function() {
if (debug) {
console.log(jsPsych.data.get().json());
}
},
});
const demo_trial = {
type: jsPsychHtmlKeyboardResponse,
stimulus: `<h1 class="text-2xl font-bold">Hello, world!</h1>`,
choices: [''],
};
const timeline = [demo_trial];
jsPsych.run(timeline);