function endTrial() {

      display_element.innerHTML = '';

      var trial_data = {
        "stimulus": JSON.stringify(trial.stimuli)
      };

      jsPsych.finishTrial(trial_data);
    }
jsPsych plugin for showing scenes that mimic the experiments described in

Fiser, J., & Aslin, R. N. (2001). Unsupervised statistical learning of
higher-order spatial structures from visual scenes. Psychological science,
12(6), 499-504.

Josh de Leeuw

documentation: docs.jspsych.org