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