jspsych 8.0.0 → 8.0.2

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.
@@ -53,7 +53,7 @@ var jsPsychModule = (function (exports) {
53
53
 
54
54
  var _package = {
55
55
  name: "jspsych",
56
- version: "8.0.0",
56
+ version: "8.0.2",
57
57
  description: "Behavioral experiments in a browser",
58
58
  type: "module",
59
59
  main: "dist/index.cjs",
@@ -136,9 +136,26 @@ var jsPsychModule = (function (exports) {
136
136
  }
137
137
  async initializeExtensions() {
138
138
  await Promise.all(
139
- this.extensionsConfiguration.map(
140
- ({ type, params = {} }) => this.getExtensionInstanceByClass(type).initialize(params)
141
- )
139
+ this.extensionsConfiguration.map(({ type, params = {} }) => {
140
+ this.getExtensionInstanceByClass(type).initialize(params);
141
+ const extensionInfo = type["info"];
142
+ if (!("version" in extensionInfo) && !("data" in extensionInfo)) {
143
+ console.warn(
144
+ extensionInfo["name"],
145
+ "is missing the 'version' and 'data' fields. Please update extension as 'version' and 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."
146
+ );
147
+ } else if (!("version" in extensionInfo)) {
148
+ console.warn(
149
+ extensionInfo["name"],
150
+ "is missing the 'version' field. Please update extension as 'version' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."
151
+ );
152
+ } else if (!("data" in extensionInfo)) {
153
+ console.warn(
154
+ extensionInfo["name"],
155
+ "is missing the 'data' field. Please update extension as 'data' will be required in v9. See https://www.jspsych.org/latest/developers/extension-development/ for more details."
156
+ );
157
+ }
158
+ })
142
159
  );
143
160
  }
144
161
  onStart(trialExtensionsConfiguration = []) {
@@ -157,11 +174,11 @@ var jsPsychModule = (function (exports) {
157
174
  ({ type, params }) => Promise.resolve(this.getExtensionInstanceByClass(type)?.on_finish(params))
158
175
  )
159
176
  );
160
- const extensionInfo = trialExtensionsConfiguration.length ? {
161
- extension_type: results.map((result) => result.extension_type),
162
- extension_version: results.map((result) => result.extension_version)
177
+ const extensionInfos = trialExtensionsConfiguration.length ? {
178
+ extension_type: trialExtensionsConfiguration.map(({ type }) => type["info"].name),
179
+ extension_version: trialExtensionsConfiguration.map(({ type }) => type["info"].version)
163
180
  } : {};
164
- results.push(extensionInfo);
181
+ results.unshift(extensionInfos);
165
182
  return Object.assign({}, ...results);
166
183
  }
167
184
  }
@@ -652,7 +669,7 @@ var jsPsychModule = (function (exports) {
652
669
  }
653
670
  }
654
671
  rootKeydownListener(e) {
655
- for (const listener of Array.from(this.listeners)) {
672
+ for (const listener of [...this.listeners]) {
656
673
  listener(e);
657
674
  }
658
675
  this.heldKeys.add(this.toLowerCaseIfInsensitive(e.key));
@@ -3083,4 +3100,4 @@ var jsPsychModule = (function (exports) {
3083
3100
 
3084
3101
  })({});
3085
3102
  var initJsPsych = jsPsychModule.initJsPsych;
3086
- //# sourceMappingURL=https://unpkg.com/jspsych@8.0.0/dist/index.browser.js.map
3103
+ //# sourceMappingURL=https://unpkg.com/jspsych@8.0.2/dist/index.browser.js.map