-
Hi all, I would like to repeat trials with the timeline variables during a predetermined time. So I wrote the loop node as follows: const loop_node = {
timeline: [trial_1],
timeline_variables: tv,
loop_function: function(data){
console.log('loop!')
if (performance.now() - base_time < phase1_time){
return true
} else {
return false
}
}
} This does not work as I expected, the loop function is called after all the timeline variables are evaluated. Is it possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @kurokida, There's no way to change when the loop function is evaluated yet. This is an interesting use case that I hadn't thought of before, so I'm glad you brought it up. I think one solution would be to add an |
Beta Was this translation helpful? Give feedback.
Hi @kurokida,
There's no way to change when the loop function is evaluated yet. This is an interesting use case that I hadn't thought of before, so I'm glad you brought it up.
I think one solution would be to add an
on_finish
totrial_1
that checks the time, and if the time has elapsed you can calljsPsych.endCurrentTimeline()
(docs).