From 2e17ca6b3332b1f14a80501e5f1aec6f6ce51eb7 Mon Sep 17 00:00:00 2001 From: bjoluc Date: Sun, 15 Aug 2021 09:59:29 +0200 Subject: [PATCH 1/3] Introduce parameterType.KEYS for multiple keys It represents an array of keys, or jsPsych.ALL_KEYS and jsPsych.NO_KEYS --- packages/jspsych/src/modules/plugins.ts | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/jspsych/src/modules/plugins.ts b/packages/jspsych/src/modules/plugins.ts index 74f88d57..3b1f17c8 100644 --- a/packages/jspsych/src/modules/plugins.ts +++ b/packages/jspsych/src/modules/plugins.ts @@ -20,14 +20,15 @@ export const parameterType = { FLOAT: 3, FUNCTION: 4, KEY: 5, - SELECT: 6, - HTML_STRING: 7, - IMAGE: 8, - AUDIO: 9, - VIDEO: 10, - OBJECT: 11, - COMPLEX: 12, - TIMELINE: 13, + KEYS: 6, + SELECT: 7, + HTML_STRING: 8, + IMAGE: 9, + AUDIO: 10, + VIDEO: 11, + OBJECT: 12, + COMPLEX: 13, + TIMELINE: 14, }; type ParameterTypeMap = { @@ -37,14 +38,15 @@ type ParameterTypeMap = { 3: number; // FLOAT 4: (...args: any[]) => any; // FUNCTION 5: string; // KEY - 6: any; // SELECT - 7: string; // HTML_STRING - 8: string; // IMAGE - 9: string; // AUDIO - 10: string; // VIDEO - 11: object; // OBJECT - 12: any; // COMPLEX - 13: any; // TIMELINE + 6: string[] | "none" | "allkeys"; // KEYS + 7: any; // SELECT + 8: string; // HTML_STRING + 9: string; // IMAGE + 10: string; // AUDIO + 11: string; // VIDEO + 12: object; // OBJECT + 13: any; // COMPLEX + 14: any; // TIMELINE }; export interface ParameterInfo { @@ -59,7 +61,7 @@ export interface ParameterInfos { [key: string]: ParameterInfo; } -type ParameterType = I["array"] extends boolean // Hack to deal with type widening in parameter declarations inferred from JavaScript +type ParameterType = I["array"] extends true ? Array : ParameterTypeMap[I["type"]]; From 743ad44e842b745d43c9758dd9019ecbea0af23d Mon Sep 17 00:00:00 2001 From: bjoluc Date: Sun, 15 Aug 2021 10:10:28 +0200 Subject: [PATCH 2/3] Replace `ALL_KEYS` and `NO_KEYS` with strings `"ALL_KEYS"` is now used instead of `jsPsych.ALL_KEYS` and `"NO_KEYS"` instead of `jsPsych.NO_KEYS` --- packages/jspsych/src/JsPsych.ts | 4 ---- .../src/modules/plugin-api/KeyboardListenerAPI.ts | 11 +++-------- packages/jspsych/src/modules/plugin-api/index.ts | 7 +------ packages/jspsych/src/modules/plugins.ts | 2 +- packages/jspsych/tests/pluginAPI/pluginapi.test.ts | 8 ++++---- packages/plugin-html-keyboard-response/src/index.ts | 2 +- 6 files changed, 10 insertions(+), 24 deletions(-) diff --git a/packages/jspsych/src/JsPsych.ts b/packages/jspsych/src/JsPsych.ts index 04f3a0fe..a9d801c6 100644 --- a/packages/jspsych/src/JsPsych.ts +++ b/packages/jspsych/src/JsPsych.ts @@ -140,10 +140,6 @@ export class JsPsych { this.pluginAPI.initAudio(); } - // enumerated variables for special parameter types - readonly ALL_KEYS = "allkeys"; - readonly NO_KEYS = "none"; - /** * Starts an experiment using the provided timeline and returns a promise that is resolved when * the experiment is finished. diff --git a/packages/jspsych/src/modules/plugin-api/KeyboardListenerAPI.ts b/packages/jspsych/src/modules/plugin-api/KeyboardListenerAPI.ts index 914b4f26..8d8a52c9 100644 --- a/packages/jspsych/src/modules/plugin-api/KeyboardListenerAPI.ts +++ b/packages/jspsych/src/modules/plugin-api/KeyboardListenerAPI.ts @@ -1,10 +1,5 @@ export class KeyboardListenerAPI { - constructor( - private areResponsesCaseSensitive: boolean, - private minimumValidRt = 0, - private readonly ALL_KEYS = "allkeys", - private readonly NO_KEYS = "none" - ) {} + constructor(private areResponsesCaseSensitive: boolean, private minimumValidRt = 0) {} private keyboard_listeners = []; @@ -83,9 +78,9 @@ export class KeyboardListenerAPI { var valid_response = false; if (typeof parameters.valid_responses === "undefined") { valid_response = true; - } else if (parameters.valid_responses == this.ALL_KEYS) { + } else if (parameters.valid_responses == "ALL_KEYS") { valid_response = true; - } else if (parameters.valid_responses != this.NO_KEYS) { + } else if (parameters.valid_responses != "NO_KEYS") { if (parameters.valid_responses.includes(e.key)) { valid_response = true; } diff --git a/packages/jspsych/src/modules/plugin-api/index.ts b/packages/jspsych/src/modules/plugin-api/index.ts index 42cede2e..2f2168c6 100644 --- a/packages/jspsych/src/modules/plugin-api/index.ts +++ b/packages/jspsych/src/modules/plugin-api/index.ts @@ -11,12 +11,7 @@ export function createJointPluginAPIObject(jsPsych: JsPsych) { return Object.assign( {}, ...[ - new KeyboardListenerAPI( - settings.case_sensitive_responses, - settings.minimum_valid_rt, - jsPsych.ALL_KEYS, - jsPsych.NO_KEYS - ), + new KeyboardListenerAPI(settings.case_sensitive_responses, settings.minimum_valid_rt), new TimeoutAPI(), new MediaAPI(settings.use_webaudio, jsPsych.webaudio_context), new HardwareAPI(), diff --git a/packages/jspsych/src/modules/plugins.ts b/packages/jspsych/src/modules/plugins.ts index 3b1f17c8..3ea681fa 100644 --- a/packages/jspsych/src/modules/plugins.ts +++ b/packages/jspsych/src/modules/plugins.ts @@ -38,7 +38,7 @@ type ParameterTypeMap = { 3: number; // FLOAT 4: (...args: any[]) => any; // FUNCTION 5: string; // KEY - 6: string[] | "none" | "allkeys"; // KEYS + 6: string[] | "ALL_KEYS" | "NO_KEYS"; // KEYS 7: any; // SELECT 8: string; // HTML_STRING 9: string; // IMAGE diff --git a/packages/jspsych/tests/pluginAPI/pluginapi.test.ts b/packages/jspsych/tests/pluginAPI/pluginapi.test.ts index b882b480..6dcf96ab 100644 --- a/packages/jspsych/tests/pluginAPI/pluginapi.test.ts +++ b/packages/jspsych/tests/pluginAPI/pluginapi.test.ts @@ -51,10 +51,10 @@ describe("#getKeyboardResponse", () => { expect(callback).toHaveBeenCalledTimes(1); }); - test("should not respond when jsPsych.NO_KEYS is used", () => { + test('should not respond when "NO_KEYS" is used', () => { jsPsych.pluginAPI.getKeyboardResponse({ callback_function: callback, - valid_responses: jsPsych.NO_KEYS, + valid_responses: "NO_KEYS", }); expect(callback).toHaveBeenCalledTimes(0); @@ -69,7 +69,7 @@ describe("#getKeyboardResponse", () => { jsPsych.pluginAPI.getKeyboardResponse({ callback_function: callback, - valid_responses: jsPsych.ALL_KEYS, + valid_responses: "ALL_KEYS", allow_held_key: false, }); @@ -85,7 +85,7 @@ describe("#getKeyboardResponse", () => { jsPsych.pluginAPI.getKeyboardResponse({ callback_function: callback, - valid_responses: jsPsych.ALL_KEYS, + valid_responses: "ALL_KEYS", allow_held_key: true, }); diff --git a/packages/plugin-html-keyboard-response/src/index.ts b/packages/plugin-html-keyboard-response/src/index.ts index ef94ccef..a8ee6b09 100644 --- a/packages/plugin-html-keyboard-response/src/index.ts +++ b/packages/plugin-html-keyboard-response/src/index.ts @@ -18,7 +18,7 @@ const info = { type: parameterType.KEY, array: true, pretty_name: "Choices", - default: "allkeys", // cannot access jsPsych.ALL_KEYS here – ideally, it would be static + default: "ALL_KEYS", }, /** * Any content here will be displayed below the stimulus. From 9c519853fef2d3f5743330525a52d09867baac8e Mon Sep 17 00:00:00 2001 From: bjoluc Date: Tue, 17 Aug 2021 17:19:25 +0200 Subject: [PATCH 3/3] Use enum for parameter types and remove `JsPsych.plugins` `const parameterType` is now `enum ParameterType` and can only be accessed by importing it. --- docs/overview/dynamic-parameters.md | 2 +- packages/jspsych/src/JsPsych.ts | 13 ++- packages/jspsych/src/TimelineNode.ts | 8 +- packages/jspsych/src/index.ts | 10 ++- packages/jspsych/src/modules/plugins.ts | 88 ++++++++++--------- .../core/functions-as-parameters.test.ts | 12 +-- packages/jspsych/tests/core/timelines.test.ts | 22 ++--- .../src/index.ts | 14 +-- 8 files changed, 88 insertions(+), 81 deletions(-) diff --git a/docs/overview/dynamic-parameters.md b/docs/overview/dynamic-parameters.md index b417c616..5ba86df5 100644 --- a/docs/overview/dynamic-parameters.md +++ b/docs/overview/dynamic-parameters.md @@ -142,6 +142,6 @@ var trial = { ``` ## When dynamic parameters can't be used -Note that if the plugin *expects* the value of a given parameter to be a function, then this function *will not* be evaluated at the start of the trial. This is because some plugins allow the researcher to specify functions that should be called at some point during the trial. Some examples of this include the `stimulus` parameter in the canvas-* plugins, the `mistake_fn` parameter in the cloze plugin, and the `stim_function` parameter in the reconstruction plugin. If you want to check whether this is the case for a particular plugin and parameter, then the parameter's `type` in the `plugin.info` section of the plugin file. If the parameter type is `jsPsych.plugins.parameterType.FUNCTION`, then this parameter must be a function and it will not be executed before the trial starts. +Note that if the plugin *expects* the value of a given parameter to be a function, then this function *will not* be evaluated at the start of the trial. This is because some plugins allow the researcher to specify functions that should be called at some point during the trial. Some examples of this include the `stimulus` parameter in the canvas-* plugins, the `mistake_fn` parameter in the cloze plugin, and the `stim_function` parameter in the reconstruction plugin. If you want to check whether this is the case for a particular plugin and parameter, then the parameter's `type` in the `plugin.info` section of the plugin file. If the parameter type is `ParameterType.FUNCTION`, then this parameter must be a function and it will not be executed before the trial starts. Even though function evaluation doesn't work the same way with these parameters, the fact that the parameters are functions means that you can get the same dynamic functionality. These functions are typically evaluated at some point during the trial, so you still get updates to values within the function during the trial. \ No newline at end of file diff --git a/packages/jspsych/src/JsPsych.ts b/packages/jspsych/src/JsPsych.ts index a9d801c6..fdca1cd4 100644 --- a/packages/jspsych/src/JsPsych.ts +++ b/packages/jspsych/src/JsPsych.ts @@ -3,7 +3,7 @@ import autoBind from "auto-bind"; import { version } from "../package.json"; import { JsPsychData } from "./modules/data"; import { PluginAPI, createJointPluginAPIObject } from "./modules/plugin-api"; -import * as plugins from "./modules/plugins"; +import { ParameterType, universalPluginParameters } from "./modules/plugins"; import * as randomization from "./modules/randomization"; import * as turk from "./modules/turk"; import * as utils from "./modules/utils"; @@ -15,7 +15,6 @@ function delay(ms: number) { export class JsPsych { extensions = {}; - plugins = plugins; turk = turk; randomization = randomization; utils = utils; @@ -610,14 +609,14 @@ export class JsPsych { // the first line checks if the parameter is defined in the universalPluginParameters set // the second line checks the plugin-specific parameters if ( - typeof this.plugins.universalPluginParameters[key] !== "undefined" && - this.plugins.universalPluginParameters[key].type !== this.plugins.parameterType.FUNCTION + typeof universalPluginParameters[key] !== "undefined" && + universalPluginParameters[key].type !== ParameterType.FUNCTION ) { trial[key] = this.replaceFunctionsWithValues(trial[key], null); } if ( typeof trial.type.info.parameters[key] !== "undefined" && - trial.type.info.parameters[key].type !== this.plugins.parameterType.FUNCTION + trial.type.info.parameters[key].type !== ParameterType.FUNCTION ) { trial[key] = this.replaceFunctionsWithValues(trial[key], trial.type.info.parameters[key]); } @@ -654,7 +653,7 @@ export class JsPsych { for (var i = 0; i < keys.length; i++) { if ( typeof info.nested[keys[i]] == "object" && - info.nested[keys[i]].type !== this.plugins.parameterType.FUNCTION + info.nested[keys[i]].type !== ParameterType.FUNCTION ) { obj[keys[i]] = this.replaceFunctionsWithValues(obj[keys[i]], info.nested[keys[i]]); } @@ -669,7 +668,7 @@ export class JsPsych { private setDefaultValues(trial) { for (var param in trial.type.info.parameters) { // check if parameter is complex with nested defaults - if (trial.type.info.parameters[param].type == this.plugins.parameterType.COMPLEX) { + if (trial.type.info.parameters[param].type == ParameterType.COMPLEX) { if (trial.type.info.parameters[param].array == true) { // iterate over each entry in the array trial[param].forEach(function (ip, i) { diff --git a/packages/jspsych/src/TimelineNode.ts b/packages/jspsych/src/TimelineNode.ts index dd03eaf9..6660f721 100644 --- a/packages/jspsych/src/TimelineNode.ts +++ b/packages/jspsych/src/TimelineNode.ts @@ -1,5 +1,5 @@ import { JsPsych } from "./JsPsych"; -import { parameterType } from "./modules/plugins"; +import { ParameterType } from "./modules/plugins"; import { repeat, sampleWithReplacement, @@ -546,9 +546,9 @@ export class TimelineNode { /** Maps parameter types to their corresponding preload type */ const parameterTypeMap = new Map([ - [parameterType.AUDIO, "audio"], - [parameterType.IMAGE, "image"], - [parameterType.VIDEO, "video"], + [ParameterType.AUDIO, "audio"], + [ParameterType.IMAGE, "image"], + [ParameterType.VIDEO, "video"], ]); function recurseTimeline(node: TimelineNode) { diff --git a/packages/jspsych/src/index.ts b/packages/jspsych/src/index.ts index a68d8bbe..1d017e48 100755 --- a/packages/jspsych/src/index.ts +++ b/packages/jspsych/src/index.ts @@ -24,5 +24,11 @@ export function initJsPsych(options?) { } export { JsPsych } from "./JsPsych"; -export { JsPsychPlugin, PluginInfo, TrialType } from "./modules/plugins"; -export { parameterType } from "./modules/plugins"; +export { + JsPsychPlugin, + PluginInfo, + TrialType, + ParameterType, + universalPluginParameters, + UniversalPluginParameters, +} from "./modules/plugins"; diff --git a/packages/jspsych/src/modules/plugins.ts b/packages/jspsych/src/modules/plugins.ts index 3ea681fa..25e62148 100644 --- a/packages/jspsych/src/modules/plugins.ts +++ b/packages/jspsych/src/modules/plugins.ts @@ -12,45 +12,47 @@ type SetRequired = Simplify< Omit & Required> >; -// enumerate possible parameter types for plugins -export const parameterType = { - BOOL: 0, - STRING: 1, - INT: 2, - FLOAT: 3, - FUNCTION: 4, - KEY: 5, - KEYS: 6, - SELECT: 7, - HTML_STRING: 8, - IMAGE: 9, - AUDIO: 10, - VIDEO: 11, - OBJECT: 12, - COMPLEX: 13, - TIMELINE: 14, -}; +/** + * Parameter types for plugins + */ +export enum ParameterType { + BOOL, + STRING, + INT, + FLOAT, + FUNCTION, + KEY, + KEYS, + SELECT, + HTML_STRING, + IMAGE, + AUDIO, + VIDEO, + OBJECT, + COMPLEX, + TIMELINE, +} type ParameterTypeMap = { - 0: boolean; // BOOL - 1: string; // STRING - 2: number; // INT - 3: number; // FLOAT - 4: (...args: any[]) => any; // FUNCTION - 5: string; // KEY - 6: string[] | "ALL_KEYS" | "NO_KEYS"; // KEYS - 7: any; // SELECT - 8: string; // HTML_STRING - 9: string; // IMAGE - 10: string; // AUDIO - 11: string; // VIDEO - 12: object; // OBJECT - 13: any; // COMPLEX - 14: any; // TIMELINE + [ParameterType.BOOL]: boolean; + [ParameterType.STRING]: string; + [ParameterType.INT]: number; + [ParameterType.FLOAT]: number; + [ParameterType.FUNCTION]: (...args: any[]) => any; + [ParameterType.KEY]: string; + [ParameterType.KEYS]: string[] | "ALL_KEYS" | "NO_KEYS"; + [ParameterType.SELECT]: any; + [ParameterType.HTML_STRING]: string; + [ParameterType.IMAGE]: string; + [ParameterType.AUDIO]: string; + [ParameterType.VIDEO]: string; + [ParameterType.OBJECT]: object; + [ParameterType.COMPLEX]: any; + [ParameterType.TIMELINE]: any; }; export interface ParameterInfo { - type: keyof ParameterTypeMap; + type: ParameterType; array?: boolean; pretty_name?: string; default?: any; @@ -61,7 +63,7 @@ export interface ParameterInfos { [key: string]: ParameterInfo; } -type ParameterType = I["array"] extends true +type InferredParameter = I["array"] extends true ? Array : ParameterTypeMap[I["type"]]; @@ -71,17 +73,17 @@ type RequiredParameterNames = { type InferredParameters = SetRequired< { - [Property in keyof I]?: ParameterType; + [Property in keyof I]?: InferredParameter; }, RequiredParameterNames >; -export const universalPluginParameters: ParameterInfos = { +export const universalPluginParameters = { /** * Data to add to this trial (key-value pairs) */ data: { - type: parameterType.OBJECT, + type: ParameterType.OBJECT, pretty_name: "Data", default: {}, }, @@ -89,7 +91,7 @@ export const universalPluginParameters: ParameterInfos = { * Function to execute when trial begins */ on_start: { - type: parameterType.FUNCTION, + type: ParameterType.FUNCTION, pretty_name: "On start", default: function () { return; @@ -99,7 +101,7 @@ export const universalPluginParameters: ParameterInfos = { * Function to execute when trial is finished */ on_finish: { - type: parameterType.FUNCTION, + type: ParameterType.FUNCTION, pretty_name: "On finish", default: function () { return; @@ -109,7 +111,7 @@ export const universalPluginParameters: ParameterInfos = { * Function to execute after the trial has loaded */ on_load: { - type: parameterType.FUNCTION, + type: ParameterType.FUNCTION, pretty_name: "On load", default: function () { return; @@ -119,7 +121,7 @@ export const universalPluginParameters: ParameterInfos = { * Length of gap between the end of this trial and the start of the next trial */ post_trial_gap: { - type: parameterType.INT, + type: ParameterType.INT, pretty_name: "Post trial gap", default: null, }, @@ -127,7 +129,7 @@ export const universalPluginParameters: ParameterInfos = { * A list of CSS classes to add to the jsPsych display element for the duration of this trial */ css_classes: { - type: parameterType.STRING, + type: ParameterType.STRING, pretty_name: "Custom CSS classes", default: null, }, diff --git a/packages/jspsych/tests/core/functions-as-parameters.test.ts b/packages/jspsych/tests/core/functions-as-parameters.test.ts index de5f6382..795de501 100644 --- a/packages/jspsych/tests/core/functions-as-parameters.test.ts +++ b/packages/jspsych/tests/core/functions-as-parameters.test.ts @@ -1,7 +1,7 @@ // import cloze from "@jspsych/plugin-cloze"; import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; -import { JsPsych, JsPsychPlugin, TrialType, parameterType } from "../../src"; +import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "../../src"; import { clickTarget, pressKey, startTimeline } from "../utils"; // import surveyMultiChoice from "@jspsych/plugin-survey-multi-choice"; @@ -20,7 +20,7 @@ describe("standard use of function as parameter", () => { pressKey("a"); }); - test.skip("parameters can be protected from early evaluation using jsPsych.plugins.parameterType.FUNCTION", async () => { + test.skip("parameters can be protected from early evaluation using ParameterType.FUNCTION", async () => { var mock = jest.fn(); await startTimeline([ @@ -142,22 +142,22 @@ describe("nested parameters as functions", () => { await expectFinished(); }); - test("nested parameters can be protected from early evaluation using jsPsych.plugins.parameterType.FUNCTION", async () => { + test("nested parameters can be protected from early evaluation using ParameterType.FUNCTION", async () => { // currently no plugins that use this feature (Jan. 2021), so here's a simple placeholder plugin. const info = { name: "function-test-plugin", parameters: { foo: { - type: parameterType.COMPLEX, + type: ParameterType.COMPLEX, default: null, nested: { not_protected: { - type: parameterType.STRING, + type: ParameterType.STRING, default: null, }, protected: { - type: parameterType.FUNCTION, + type: ParameterType.FUNCTION, default: null, }, }, diff --git a/packages/jspsych/tests/core/timelines.test.ts b/packages/jspsych/tests/core/timelines.test.ts index ac667985..915b63b9 100644 --- a/packages/jspsych/tests/core/timelines.test.ts +++ b/packages/jspsych/tests/core/timelines.test.ts @@ -1,6 +1,6 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; -import { initJsPsych, parameterType } from "../../src"; +import { ParameterType, initJsPsych } from "../../src"; import { TimelineNode } from "../../src/TimelineNode"; import { pressKey, startTimeline } from "../utils"; @@ -520,13 +520,13 @@ describe("TimelineNode", () => { info: { name: "my-plugin", parameters: { - one: { type: parameterType.IMAGE }, - two: { type: parameterType.VIDEO }, - three: { type: parameterType.AUDIO }, - four: { type: parameterType.IMAGE, preload: true }, - five: { type: parameterType.IMAGE, preload: false }, + one: { type: ParameterType.IMAGE }, + two: { type: ParameterType.VIDEO }, + three: { type: ParameterType.AUDIO }, + four: { type: ParameterType.IMAGE, preload: true }, + five: { type: ParameterType.IMAGE, preload: false }, six: { - type: parameterType.STRING, + type: ParameterType.STRING, // This is illegal! But it should still not be added preload: true, }, @@ -551,7 +551,7 @@ describe("TimelineNode", () => { type: { info: { name: "plugin1", - parameters: { one: { type: parameterType.STRING } }, + parameters: { one: { type: ParameterType.STRING } }, }, }, }, @@ -559,7 +559,7 @@ describe("TimelineNode", () => { type: { info: { name: "plugin2", - parameters: { one: { type: parameterType.AUDIO } }, + parameters: { one: { type: ParameterType.AUDIO } }, }, }, }, @@ -570,8 +570,8 @@ describe("TimelineNode", () => { info: { name: "plugin3", parameters: { - one: { type: parameterType.VIDEO }, - two: { type: parameterType.IMAGE }, + one: { type: ParameterType.VIDEO }, + two: { type: ParameterType.IMAGE }, }, }, }, diff --git a/packages/plugin-html-keyboard-response/src/index.ts b/packages/plugin-html-keyboard-response/src/index.ts index a8ee6b09..2cee1064 100644 --- a/packages/plugin-html-keyboard-response/src/index.ts +++ b/packages/plugin-html-keyboard-response/src/index.ts @@ -1,4 +1,4 @@ -import { JsPsych, JsPsychPlugin, TrialType, parameterType } from "jspsych"; +import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; const info = { name: "html-keyboard-response", @@ -7,7 +7,7 @@ const info = { * The HTML string to be displayed */ stimulus: { - type: parameterType.HTML_STRING, + type: ParameterType.HTML_STRING, pretty_name: "Stimulus", default: undefined, }, @@ -15,7 +15,7 @@ const info = { * The keys the subject is allowed to press to respond to the stimulus. */ choices: { - type: parameterType.KEY, + type: ParameterType.KEY, array: true, pretty_name: "Choices", default: "ALL_KEYS", @@ -24,7 +24,7 @@ const info = { * Any content here will be displayed below the stimulus. */ prompt: { - type: parameterType.STRING, + type: ParameterType.STRING, pretty_name: "Prompt", default: null, }, @@ -32,7 +32,7 @@ const info = { * How long to hide the stimulus. */ stimulus_duration: { - type: parameterType.INT, + type: ParameterType.INT, pretty_name: "Stimulus duration", default: null, }, @@ -40,7 +40,7 @@ const info = { * How long to show trial before it ends. */ trial_duration: { - type: parameterType.INT, + type: ParameterType.INT, pretty_name: "Trial duration", default: null, }, @@ -48,7 +48,7 @@ const info = { * If true, trial will end when subject makes a response. */ response_ends_trial: { - type: parameterType.BOOL, + type: ParameterType.BOOL, pretty_name: "Response ends trial", default: true, },