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.cjs CHANGED
@@ -6,7 +6,7 @@ var seedrandom = require('seedrandom/lib/alea');
6
6
 
7
7
  var _package = {
8
8
  name: "jspsych",
9
- version: "8.0.3",
9
+ version: "8.1.0",
10
10
  description: "Behavioral experiments in a browser",
11
11
  type: "module",
12
12
  main: "dist/index.cjs",
@@ -2040,7 +2040,8 @@ class Timeline extends TimelineNode {
2040
2040
  }
2041
2041
  for (const timelineVariableIndex of timelineVariableOrder) {
2042
2042
  this.setCurrentTimelineVariablesByIndex(timelineVariableIndex);
2043
- for (const childNode of this.instantiateChildNodes()) {
2043
+ for (const childNodeDescription of this.description.timeline) {
2044
+ const childNode = this.instantiateChildNode(childNodeDescription);
2044
2045
  const previousChild = this.currentChild;
2045
2046
  this.currentChild = childNode;
2046
2047
  childNode.index = previousChild ? previousChild.getLatestNode().index + 1 : this.index;
@@ -2097,12 +2098,10 @@ class Timeline extends TimelineNode {
2097
2098
  }
2098
2099
  }
2099
2100
  }
2100
- instantiateChildNodes() {
2101
- const newChildNodes = this.description.timeline.map((childDescription) => {
2102
- return isTimelineDescription(childDescription) ? new Timeline(this.dependencies, childDescription, this) : new Trial(this.dependencies, childDescription, this);
2103
- });
2104
- this.children.push(...newChildNodes);
2105
- return newChildNodes;
2101
+ instantiateChildNode(childDescription) {
2102
+ const newChildNode = isTimelineDescription(childDescription) ? new Timeline(this.dependencies, childDescription, this) : new Trial(this.dependencies, childDescription, this);
2103
+ this.children.push(newChildNode);
2104
+ return newChildNode;
2106
2105
  }
2107
2106
  setCurrentTimelineVariablesByIndex(index) {
2108
2107
  this.currentTimelineVariables = {