Skip to content

Use InteractionData to automatically pause experiment #1284

Answered by jodeleeuw
mrzdcmps asked this question in Q&A
Discussion options

You must be logged in to vote

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!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mrzdcmps
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants