jsPsych/.changeset/core-rewrite.md
2022-11-09 16:28:31 +01:00

2.1 KiB

jspsych
major

Rewrite jsPsych's core logic. The following breaking changes have been made:

Timeline Events

  • conditional_function is no longer executed on every iteration of a looping timeline, but only once before running the first trial of the timeline. If you rely on the old behavior, move your conditional_function into a nested timeline instead.
  • on_timeline_start and on_timeline_finish are no longer invoked in every repetition of a timeline, but only at the beginning or at the end of the timeline, respectively. If you rely on the old behavior, move the on_timeline_start and on_timeline_finish callbacks into a nested timeline.

Timeline Variables

  • The functionality of jsPsych.timelineVariable() has been explicitly split into two functions, jsPsych.timelineVariable() and jsPsych.evaluateTimelineVariable(). Use jsPsych.timelineVariable() to create a timeline variable placeholder and jsPsych.evaluateTimelineVariable() to retrieve a given timeline variable's current value.
  • jsPsych.evaluateTimelineVariable() now throws an error if a variable is not found.

Progress Bar

  • jsPsych.setProgressBar(x) has been replaced by jsPsych.progressBar.progress = x
  • jsPsych.getProgressBarCompleted() has been replaced by jsPsych.progressBar.progress
  • The automatic progress bar updates after every trial now, including trials in nested timelines.

Data Handling

  • Timeline nodes no longer have IDs. As a consequence, the internal_node_id trial result property and jsPsych.data.getDataByTimelineNode() have been removed.
  • Unlike previously, the save_trial_parameters parameter can only be used to remove parameters that are specified in the plugin's info object. Other result properties will be left untouched.

Miscellaneous Changes

  • endExperiment() and endCurrentTimeline() have been renamed to abortExperiment() and abortCurrentTimeline(), respectively.
  • Interaction listeners are now removed when the experiment ends.
  • JsPsych now internally relies on the JavaScript event loop. This means unit tests have to await utility functions like pressKey() to let the event loop proceed.