jspsych 8.0.0 → 8.0.1

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.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.0",
7
+ version: "8.0.1",
8
8
  description: "Behavioral experiments in a browser",
9
9
  type: "module",
10
10
  main: "dist/index.cjs",
@@ -86,9 +86,26 @@ class ExtensionManager {
86
86
  }
87
87
  async initializeExtensions() {
88
88
  await Promise.all(
89
- this.extensionsConfiguration.map(
90
- ({ type, params = {} }) => this.getExtensionInstanceByClass(type).initialize(params)
91
- )
89
+ this.extensionsConfiguration.map(({ type, params = {} }) => {
90
+ this.getExtensionInstanceByClass(type).initialize(params);
91
+ const extensionInfo = type["info"];
92
+ if (!("version" in extensionInfo) && !("data" in extensionInfo)) {
93
+ console.warn(
94
+ extensionInfo["name"],
95
+ "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."
96
+ );
97
+ } else if (!("version" in extensionInfo)) {
98
+ console.warn(
99
+ extensionInfo["name"],
100
+ "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."
101
+ );
102
+ } else if (!("data" in extensionInfo)) {
103
+ console.warn(
104
+ extensionInfo["name"],
105
+ "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."
106
+ );
107
+ }
108
+ })
92
109
  );
93
110
  }
94
111
  onStart(trialExtensionsConfiguration = []) {
@@ -107,11 +124,11 @@ class ExtensionManager {
107
124
  ({ type, params }) => Promise.resolve(this.getExtensionInstanceByClass(type)?.on_finish(params))
108
125
  )
109
126
  );
110
- const extensionInfo = trialExtensionsConfiguration.length ? {
111
- extension_type: results.map((result) => result.extension_type),
112
- extension_version: results.map((result) => result.extension_version)
127
+ const extensionInfos = trialExtensionsConfiguration.length ? {
128
+ extension_type: trialExtensionsConfiguration.map(({ type }) => type["info"].name),
129
+ extension_version: trialExtensionsConfiguration.map(({ type }) => type["info"].version)
113
130
  } : {};
114
- results.push(extensionInfo);
131
+ results.unshift(extensionInfos);
115
132
  return Object.assign({}, ...results);
116
133
  }
117
134
  }