Running a while loop only after timeline node #1976
Unanswered
victoirebeaufils
asked this question in
Q&A
Replies: 1 comment
-
How are you adding and manipulating the display to show the dots and tree? Is it within the context of a plugin, or some other method? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I currently have a timeline in which I'm required to run a while loop. In this loop, I'm adding a tree picture to the timeline, then adding a dot, whose color alternates between black and white, until the user presses a key. The function waitChoice() handles that.
However, as soon as I open my index.html file, the while loop begins. Ideally, I would want it to begin only after the experiment instructions have been read, just as the experiment begins. Is there a jspsych built-in function that handles that?
The fix that I have right now would be to add the "on_data_update" parameter to the jspsych init function, and have it run a custom function that uses the DOM to check if an HTML element has been displayed before running the loop.
jsPsych.init({
timeline: instructionsTimeline,
display_element: "container",
on_data_update: allowForRunTrials
)}
Here is a code snippet of the while function:
Thanks in advance for taking the time to read this post!
Beta Was this translation helpful? Give feedback.
All reactions