Skip to content

advance external-html after a certain delay without any other triggers #1022

Answered by becky-gilbert
Quinlanptq asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Quinlanptq, I think there probably are a couple ways to do this, and I'm not sure which is best.

You could use the trial's on_start or on_load function to start a timer using setTimeout. The first setTimeout argument would be a function that ends the trial by calling jsPsych's finishTrial function, and the second argument would be your delay in ms.

on_load: function() {
  setTimeout(function() {
    jsPsych.finishTrial(); // call the finish trial function after 5 seconds
  }, 5000);
}

Keep in mind that, if it's possible for the trial to end any other way (e.g. participant's button or key press), then you'll want to make sure that you assign setTimeout to a variable and then clear the …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Quinlanptq
Comment options

@becky-gilbert
Comment options

Answer selected by becky-gilbert
Comment options

You must be logged in to vote
1 reply
@becky-gilbert
Comment options

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
3 participants