Initial commit
This commit is contained in:
32
index.js
Normal file
32
index.js
Normal 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);
|
||||
Reference in New Issue
Block a user