-
Hi, I was wondering if it's possible to use the getInteractionData function to autmatically pause the experiment when the participant switches to another tab (blur), and only resume when the windows is active again or after a confirmation of the participant. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @mrzdcmps, With the caveat that I've never actually tried this, I imagine that something like this could work: jsPsych.init({
timeline: [...],
on_interaction_data_update: function(data){
if(data.event == 'blur'){
jsPsych.pauseExperiment();
}
if(data.event == 'focus'){
jsPsych.resumeExperiment();
}
}
} Note that the pause/resume features only apply to the next trial in the timeline. The current trial cannot be paused once it is started. If you try this let us know if it works! |
Beta Was this translation helpful? Give feedback.
-
Thank you, Josh! Works as intended! |
Beta Was this translation helpful? Give feedback.
Hi @mrzdcmps,
With the caveat that I've never actually tried this, I imagine that something like this could work:
Note that the pause/resume features only apply to the next trial in the timeline. The current trial cannot be paused once it is started.
If you try this let us know if it works!