jspsych 8.0.3 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -204,7 +204,7 @@ declare class Timeline extends TimelineNode {
204
204
  * If the timeline is running or paused, aborts the timeline after the current trial has completed
205
205
  */
206
206
  abort(): void;
207
- private instantiateChildNodes;
207
+ private instantiateChildNode;
208
208
  private currentTimelineVariables;
209
209
  private setCurrentTimelineVariablesByIndex;
210
210
  /**
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import seedrandom from 'seedrandom/lib/alea';
4
4
 
5
5
  var _package = {
6
6
  name: "jspsych",
7
- version: "8.0.3",
7
+ version: "8.1.0",
8
8
  description: "Behavioral experiments in a browser",
9
9
  type: "module",
10
10
  main: "dist/index.cjs",
@@ -2038,7 +2038,8 @@ class Timeline extends TimelineNode {
2038
2038
  }
2039
2039
  for (const timelineVariableIndex of timelineVariableOrder) {
2040
2040
  this.setCurrentTimelineVariablesByIndex(timelineVariableIndex);
2041
- for (const childNode of this.instantiateChildNodes()) {
2041
+ for (const childNodeDescription of this.description.timeline) {
2042
+ const childNode = this.instantiateChildNode(childNodeDescription);
2042
2043
  const previousChild = this.currentChild;
2043
2044
  this.currentChild = childNode;
2044
2045
  childNode.index = previousChild ? previousChild.getLatestNode().index + 1 : this.index;
@@ -2095,12 +2096,10 @@ class Timeline extends TimelineNode {
2095
2096
  }
2096
2097
  }
2097
2098
  }
2098
- instantiateChildNodes() {
2099
- const newChildNodes = this.description.timeline.map((childDescription) => {
2100
- return isTimelineDescription(childDescription) ? new Timeline(this.dependencies, childDescription, this) : new Trial(this.dependencies, childDescription, this);
2101
- });
2102
- this.children.push(...newChildNodes);
2103
- return newChildNodes;
2099
+ instantiateChildNode(childDescription) {
2100
+ const newChildNode = isTimelineDescription(childDescription) ? new Timeline(this.dependencies, childDescription, this) : new Trial(this.dependencies, childDescription, this);
2101
+ this.children.push(newChildNode);
2102
+ return newChildNode;
2104
2103
  }
2105
2104
  setCurrentTimelineVariablesByIndex(index) {
2106
2105
  this.currentTimelineVariables = {