From fbe642c50fb7369f85869f93e2cf42d61831dd04 Mon Sep 17 00:00:00 2001 From: vzhang03 Date: Mon, 17 Jun 2024 12:15:29 -0400 Subject: [PATCH] Continued work updating plugins --- .../plugin-categorize-animation/src/index.ts | 66 ++++++++------ packages/plugin-categorize-html/src/index.ts | 69 +++++++------- packages/plugin-categorize-image/src/index.ts | 68 +++++++------- packages/plugin-cloze/src/index.ts | 29 +++--- packages/plugin-external-html/src/index.ts | 38 ++++---- packages/plugin-free-sort/src/index.ts | 89 ++++++++++++------- packages/plugin-fullscreen/src/index.ts | 36 +++++--- .../plugin-html-audio-response/src/index.ts | 71 ++++++++++++--- .../plugin-html-button-response/src/index.ts | 64 ++++++------- .../plugin-html-slider-response/src/index.ts | 59 ++++++------ 10 files changed, 356 insertions(+), 233 deletions(-) diff --git a/packages/plugin-categorize-animation/src/index.ts b/packages/plugin-categorize-animation/src/index.ts index 76b4f9e5f7..3af9fd21b0 100644 --- a/packages/plugin-categorize-animation/src/index.ts +++ b/packages/plugin-categorize-animation/src/index.ts @@ -1,96 +1,104 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "categorize-animation", + version: version, parameters: { - /** Array of paths to image files. */ + /** Each element of the array is a path to an image file. */ stimuli: { type: ParameterType.IMAGE, - pretty_name: "Stimuli", default: undefined, array: true, }, - /** The key to indicate correct response */ + /** The key character indicating the correct response. */ key_answer: { type: ParameterType.KEY, - pretty_name: "Key answer", default: undefined, }, - /** Array containing the key(s) the subject is allowed to press to respond to the stimuli. */ + /** This array contains the key(s) that the participant is allowed to press in order to respond to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see [this page](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) and [this page (event.key column)](https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/) for more examples. Any key presses that are not listed in the array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses. Specifying `"NO_KEYS"` will mean that no responses are allowed. */ choices: { type: ParameterType.KEYS, - pretty_name: "Choices", default: "ALL_KEYS", }, - /** Text to describe correct answer. */ + /** A text label that describes the correct answer. Used in conjunction with the `correct_text` and `incorrect_text` parameters. */ text_answer: { type: ParameterType.HTML_STRING, - pretty_name: "Text answer", default: null, }, - /** String to show when subject gives correct answer */ + /** String to show when the correct answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the %ANS% string (see example below). */ correct_text: { type: ParameterType.HTML_STRING, - pretty_name: "Correct text", default: "Correct.", }, - /** String to show when subject gives incorrect answer. */ + /** String to show when the wrong answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the %ANS% string (see example below). */ incorrect_text: { type: ParameterType.HTML_STRING, - pretty_name: "Incorrect text", default: "Wrong.", }, - /** Duration to display each image. */ + /** How long to display each image (in milliseconds). */ frame_time: { type: ParameterType.INT, - pretty_name: "Frame time", default: 500, }, - /** How many times to display entire sequence. */ + /** How many times to show the entire sequence. */ sequence_reps: { type: ParameterType.INT, - pretty_name: "Sequence repetitions", default: 1, }, - /** If true, subject can response before the animation sequence finishes */ + /** If true, the participant can respond before the animation sequence finishes. */ allow_response_before_complete: { type: ParameterType.BOOL, - pretty_name: "Allow response before complete", default: false, }, - /** How long to show feedback */ + /** How long to show the feedback (milliseconds). */ feedback_duration: { type: ParameterType.INT, - pretty_name: "Feedback duration", default: 2000, }, - /** Any content here will be displayed below the stimulus. */ + /** This string can contain HTML markup. Any content here will be displayed below the stimulus or the end of the animation depending on the allow_response_before_complete parameter. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: null, }, /** - * If true, the images will be drawn onto a canvas element (prevents blank screen between consecutive images in some browsers). - * If false, the image will be shown via an img element. + * If true, the images will be drawn onto a canvas element. This prevents a blank screen (white flash) between consecutive images in some browsers, like Firefox and Edge. + * If false, the image will be shown via an img element, as in previous versions of jsPsych. */ render_on_canvas: { type: ParameterType.BOOL, - pretty_name: "Render on canvas", default: true, }, }, + data: { + /** Array of stimuli displayed in the trial. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ + stimulus: { + type: ParameterType.STRING, + array: true, + }, + /** Indicates which key the participant pressed. */ + response: { + type: ParameterType.STRING, + }, + /** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */ + rt: { + type: ParameterType.INT, + }, + /** `true` if the participant got the correct answer, `false` otherwise. */ + correct: { + type: ParameterType.BOOL, + }, + }, }; type Info = typeof info; /** - * **categorize-animation** - * - * jsPsych plugin for categorization trials with feedback and animated stimuli + * The categorize animation plugin shows a sequence of images at a specified frame rate. The participant responds by pressing a key. Feedback indicating the correctness of the response is given. * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-categorize-animation/ categorize-animation plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/categorize-animation/ categorize-animation plugin documentation on jspsych.org} */ class CategorizeAnimationPlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-categorize-html/src/index.ts b/packages/plugin-categorize-html/src/index.ts index 68cd88abc4..723212e017 100644 --- a/packages/plugin-categorize-html/src/index.ts +++ b/packages/plugin-categorize-html/src/index.ts @@ -1,104 +1,109 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "categorize-html", + version: version, parameters: { - /** The HTML content to be displayed. */ + /** The HTML stimulus to display. */ stimulus: { type: ParameterType.HTML_STRING, - pretty_name: "Stimulus", default: undefined, }, - /** The key to indicate the correct response. */ + /** The key character indicating the correct response. */ key_answer: { type: ParameterType.KEY, - pretty_name: "Key answer", default: undefined, }, - /** Array containing the key(s) the subject is allowed to press to respond to the stimulus. */ + /** This array contains the key(s) that the participant is allowed to press in order to respond to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see [this page](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) and [this page (event.key column)](https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/) for more examples. Any key presses that are not listed in the array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses. Specifying `"NO_KEYS"` will mean that no responses are allowed. */ choices: { type: ParameterType.KEYS, - pretty_name: "Choices", default: "ALL_KEYS", }, - /** Label that is associated with the correct answer. */ + /** A label that is associated with the correct answer. Used in conjunction with the `correct_text` and `incorrect_text` parameters. */ text_answer: { type: ParameterType.HTML_STRING, - pretty_name: "Text answer", default: null, }, - /** String to show when correct answer is given. */ + /** String to show when the correct answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the `%ANS%` string (see example below). */ correct_text: { type: ParameterType.HTML_STRING, - pretty_name: "Correct text", default: "", }, - /** String to show when incorrect answer is given. */ + /** String to show when the wrong answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the `%ANS%` string (see example below). */ incorrect_text: { type: ParameterType.HTML_STRING, - pretty_name: "Incorrect text", default: "", }, - /** Any content here will be displayed below the stimulus. */ + /** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: null, }, - /** If set to true, then the subject must press the correct response key after feedback in order to advance to next trial. */ + /** If set to true, then the participant must press the correct response key after feedback is given in order to advance to the next trial. */ force_correct_button_press: { type: ParameterType.BOOL, - pretty_name: "Force correct button press", default: false, }, - /** If true, stimulus will be shown during feedback. If false, only the text feedback will be displayed during feedback. */ + /** If set to true, then the stimulus will be shown during feedback. If false, then only the text feedback will display during feedback. */ show_stim_with_feedback: { type: ParameterType.BOOL, - default: true, no_function: false, }, - /** Whether or not to show feedback following a response timeout. */ + /** If true, then category feedback will be displayed for an incorrect response after a timeout (trial_duration is exceeded). If false, then a timeout message will be shown. */ show_feedback_on_timeout: { type: ParameterType.BOOL, - pretty_name: "Show feedback on timeout", default: false, }, - /** The message displayed on a timeout non-response. */ + /** The message to show on a timeout non-response. */ timeout_message: { type: ParameterType.HTML_STRING, - pretty_name: "Timeout message", default: "

Please respond faster.

", }, - /** How long to show the stimulus. */ + /** How long to show the stimulus for (milliseconds). If null, then the stimulus is shown until a response is given. */ stimulus_duration: { type: ParameterType.INT, - pretty_name: "Stimulus duration", default: null, }, - /** How long to show trial */ + /** The maximum time allowed for a response. If null, then the experiment will wait indefinitely for a response. */ trial_duration: { type: ParameterType.INT, - pretty_name: "Trial duration", default: null, }, - /** How long to show feedback. */ + /** How long to show the feedback for (milliseconds). */ feedback_duration: { type: ParameterType.INT, - pretty_name: "Feedback duration", default: 2000, }, }, + data: { + /** Either the path to the image file or the string containing the HTML formatted content that the participant saw on this trial. */ + stimulus: { + type: ParameterType.STRING, + }, + /** Indicates which key the participant pressed. */ + response: { + type: ParameterType.STRING, + }, + /** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */ + rt: { + type: ParameterType.INT, + }, + /** `true` if the participant got the correct answer, `false` otherwise. */ + correct: { + type: ParameterType.BOOL, + }, + }, }; type Info = typeof info; /** - * **categorize-html** - * - * jsPsych plugin for categorization trials with feedback + * The categorize html plugin shows an HTML object on the screen. The participant responds by pressing a key. Feedback indicating the correctness of the response is given. * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-categorize-html/ categorize-html plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/categorize-html/ categorize-html plugin documentation on jspsych.org} */ class CategorizeHtmlPlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-categorize-image/src/index.ts b/packages/plugin-categorize-image/src/index.ts index 3fdab1f2e4..810a6fcba3 100644 --- a/packages/plugin-categorize-image/src/index.ts +++ b/packages/plugin-categorize-image/src/index.ts @@ -1,104 +1,110 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "categorize-image", + version: version, parameters: { - /** The image content to be displayed. */ + /** The path to the image file. */ stimulus: { type: ParameterType.IMAGE, - pretty_name: "Stimulus", default: undefined, }, - /** The key to indicate the correct response. */ + /** The key character indicating the correct response. */ key_answer: { type: ParameterType.KEY, - pretty_name: "Key answer", default: undefined, }, - /** Array containing the key(s) the subject is allowed to press to respond to the stimulus. */ + /** This array contains the key(s) that the participant is allowed to press in order to respond to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see [this page](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) and [this page (event.key column)](https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/) for more examples. Any key presses that are not listed in the array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses. Specifying `"NO_KEYS"` will mean that no responses are allowed. */ choices: { type: ParameterType.KEYS, - pretty_name: "Choices", default: "ALL_KEYS", }, - /** Label that is associated with the correct answer. */ + /** A label that is associated with the correct answer. Used in conjunction with the `correct_text` and `incorrect_text` parameters.*/ text_answer: { type: ParameterType.HTML_STRING, - pretty_name: "Text answer", default: null, }, - /** String to show when correct answer is given. */ + /** String to show when the correct answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the %ANS% string (see example below). */ correct_text: { type: ParameterType.HTML_STRING, - pretty_name: "Correct text", default: "", }, - /** String to show when incorrect answer is given. */ + /** String to show when the wrong answer is given. Can contain HTML formatting. The special string `%ANS%` can be used within the string. If present, the plugin will put the `text_answer` for the trial in place of the %ANS% string (see example below). */ incorrect_text: { type: ParameterType.HTML_STRING, - pretty_name: "Incorrect text", default: "", }, - /** Any content here will be displayed below the stimulus. */ + /** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: null, }, - /** If set to true, then the subject must press the correct response key after feedback in order to advance to next trial. */ + /** If set to true, then the participant must press the correct response key after feedback is given in order to advance to the next trial. */ force_correct_button_press: { type: ParameterType.BOOL, - pretty_name: "Force correct button press", default: false, }, - /** Whether or not the stimulus should be shown on the feedback screen. */ + /** If set to true, then the stimulus will be shown during feedback. If false, then only the text feedback will display during feedback.*/ show_stim_with_feedback: { type: ParameterType.BOOL, default: true, no_function: false, }, - /** If true, stimulus will be shown during feedback. If false, only the text feedback will be displayed during feedback. */ + /** If true, then category feedback will be displayed for an incorrect response after a timeout (trial_duration is exceeded). If false, then a timeout message will be shown. */ show_feedback_on_timeout: { type: ParameterType.BOOL, - pretty_name: "Show feedback on timeout", default: false, }, - /** The message displayed on a timeout non-response. */ + /** The message to show on a timeout non-response. */ timeout_message: { type: ParameterType.HTML_STRING, - pretty_name: "Timeout message", default: "

Please respond faster.

", }, - /** How long to show the stimulus. */ + /** How long to show the stimulus for (milliseconds). If null, then the stimulus is shown until a response is given. */ stimulus_duration: { type: ParameterType.INT, - pretty_name: "Stimulus duration", default: null, }, - /** How long to show the trial. */ + /** The maximum time allowed for a response. If null, then the experiment will wait indefinitely for a response. */ trial_duration: { type: ParameterType.INT, - pretty_name: "Trial duration", default: null, }, - /** How long to show the feedback. */ + /** How long to show the feedback for (milliseconds). */ feedback_duration: { type: ParameterType.INT, - pretty_name: "Feedback duration", default: 2000, }, }, + data: { + /** Either the path to the image file or the string containing the HTML formatted content that the participant saw on this trial.*/ + stimulus: { + type: ParameterType.STRING, + }, + /** Indicates which key the participant pressed. */ + response: { + type: ParameterType.STRING, + }, + /** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */ + rt: { + type: ParameterType.INT, + }, + /** `true` if the participant got the correct answer, `false` otherwise. */ + correct: { + type: ParameterType.BOOL, + }, + }, }; type Info = typeof info; /** - * **categorize-image** - * - * jsPsych plugin for image categorization trials with feedback + * The categorize image plugin shows an image object on the screen. The participant responds by pressing a key. Feedback indicating the correctness of the response is given. * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-categorize-image/ categorize-image plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/categorize-image/ categorize-image plugin documentation on jspsych.org} */ class CategorizeImagePlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-cloze/src/index.ts b/packages/plugin-cloze/src/index.ts index fc20f882c0..5fc439de94 100644 --- a/packages/plugin-cloze/src/index.ts +++ b/packages/plugin-cloze/src/index.ts @@ -1,50 +1,53 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "cloze", + version: version, parameters: { - /** The cloze text to be displayed. Blanks are indicated by %% signs and automatically replaced by input fields. If there is a correct answer you want the system to check against, it must be typed between the two percentage signs (i.e. %solution%). */ + /** The cloze text to be displayed. Blanks are indicated by %% signs and automatically replaced by input fields. If there is a correct answer you want the system to check against, it must be typed between the two percentage signs (i.e. % correct solution %). */ text: { type: ParameterType.HTML_STRING, - pretty_name: "Cloze text", default: undefined, }, /** Text of the button participants have to press for finishing the cloze test. */ button_text: { type: ParameterType.STRING, - pretty_name: "Button text", default: "OK", }, - /** Boolean value indicating if the answers given by participants should be compared against a correct solution given in the text (between % signs) after the button was clicked. */ + /** Boolean value indicating if the answers given by participants should be compared against a correct solution given in the text (between % signs) after the button was clicked. If ```true```, answers are checked and in case of differences, the ```mistake_fn``` is called. In this case, the trial does not automatically finish. If ```false```, no checks are performed and the trial automatically ends when clicking the button. */ check_answers: { type: ParameterType.BOOL, - pretty_name: "Check answers", default: false, }, - /** Boolean value indicating if the participant may leave answers blank. */ + /** Boolean value indicating if the answers given by participants should be checked for completion after the button was clicked. If ```true```, answers are not checked for completion and blank answers are allowed. The trial will then automatically finish upon the clicking the button. If ```false```, answers are checked for completion, and in case there are some fields with missing answers, the ```mistake_fn``` is called. In this case, the trial does not automatically finish. */ allow_blanks: { type: ParameterType.BOOL, - pretty_name: "Allow blanks", default: true, }, - /** Function called if either the check_answers is set to TRUE or the allow_blanks is set to FALSE and there is a discrepancy between the set answers and the answers provide or if all input fields aren't filled out, respectively. */ + /** Function called if ```check_answers``` is set to ```true``` and there is a difference between the participant's answers and the correct solution provided in the text, or if ```allow_blanks``` is set to ```false``` and there is at least one field with a blank answer. */ mistake_fn: { type: ParameterType.FUNCTION, - pretty_name: "Mistake function", default: () => {}, }, }, + data: { + /** Answers the partcipant gave. */ + response: { + type: ParameterType.STRING, + array: true, + }, + }, }; type Info = typeof info; /** - * **cloze** - * - * jsPsych plugin for displaying a cloze test and checking participants answers against a correct solution + * This plugin displays a text with certain words omitted. Participants are asked to replace the missing items. Responses are recorded when clicking a button. Responses can be evaluated and a function is called in case of either differences or incomplete answers, making it possible to inform participants about mistakes before proceeding. * * @author Philipp Sprengholz - * @see {@link https://www.jspsych.org/plugins/jspsych-cloze/ cloze plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/cloze/ cloze plugin documentation on jspsych.org} */ class ClozePlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-external-html/src/index.ts b/packages/plugin-external-html/src/index.ts index 590544be3f..0627def8ee 100644 --- a/packages/plugin-external-html/src/index.ts +++ b/packages/plugin-external-html/src/index.ts @@ -1,58 +1,62 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "external-html", + version: version, parameters: { - /** The url of the external html page */ + /** The URL of the page to display. */ url: { type: ParameterType.STRING, - pretty_name: "URL", default: undefined, }, - /** The key to continue to the next page. */ + /** The key character the participant can use to advance to the next trial. If left as null, then the participant will not be able to advance trials using the keyboard. */ cont_key: { type: ParameterType.KEY, - pretty_name: "Continue key", default: null, }, - /** The button to continue to the next page. */ + /** The ID of a clickable element on the page. When the element is clicked, the trial will advance. */ cont_btn: { type: ParameterType.STRING, - pretty_name: "Continue button", default: null, }, - /** Function to check whether user is allowed to continue after clicking cont_key or clicking cont_btn */ + /** `function(){ return true; }` | This function is called with the jsPsych `display_element` as the only argument when the participant attempts to advance the trial. The trial will only advance if the function return `true`. This can be used to verify that the participant has correctly filled out a form before continuing, for example. */ check_fn: { type: ParameterType.FUNCTION, - pretty_name: "Check function", default: () => true, }, - /** Whether or not to force a page refresh. */ + /** If `true`, then the plugin will avoid using the cached version of the HTML page to load if one exists. */ force_refresh: { type: ParameterType.BOOL, - pretty_name: "Force refresh", default: false, }, - /** If execute_Script == true, then all JavasScript code on the external page will be executed. */ + /** If `true`, then scripts on the remote page will be executed. */ execute_script: { type: ParameterType.BOOL, pretty_name: "Execute scripts", default: false, }, }, + data: { + /** The url of the page. */ + url: { + type: ParameterType.STRING, + }, + /** The response time in milliseconds for the participant to finish the trial. */ + rt: { + type: ParameterType.INT, + }, + }, }; type Info = typeof info; /** - * **external-html** - * - * jsPsych plugin to load and display an external html page. To proceed to the next trial, the - * user might either press a button on the page or a specific key. Afterwards, the page will be hidden and - * the experiment will continue. + * The HTML plugin displays an external HTML document (often a consent form). Either a keyboard response or a button press can be used to continue to the next trial. It allows the experimenter to check if conditions are met (such as indicating informed consent) before continuing. * * @author Erik Weitnauer - * @see {@link https://www.jspsych.org/plugins/jspsych-external-html/ external-html plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/external-html/ external-html plugin documentation on jspsych.org} */ class ExternalHtmlPlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-free-sort/src/index.ts b/packages/plugin-free-sort/src/index.ts index ccfad66c97..9c7aaf6c8d 100644 --- a/packages/plugin-free-sort/src/index.ts +++ b/packages/plugin-free-sort/src/index.ts @@ -1,71 +1,65 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; import { inside_ellipse, make_arr, random_coordinate, shuffle } from "./utils"; +// import { parameterPathArrayToString } from "jspsych/src/timeline/util"; + const info = { name: "free-sort", + version: version, parameters: { - /** Array of images to be displayed and sorted. */ + /** Each element of this array is an image path. */ stimuli: { type: ParameterType.IMAGE, - pretty_name: "Stimuli", default: undefined, array: true, }, - /** Height of items in pixels. */ + /** The height of the images in pixels. */ stim_height: { type: ParameterType.INT, - pretty_name: "Stimulus height", default: 100, }, - /** Width of items in pixels */ + /** The width of the images in pixels. */ stim_width: { type: ParameterType.INT, - pretty_name: "Stimulus width", default: 100, }, - /** How much larger to make the stimulus while moving (1 = no scaling) */ + /** How much larger to make the stimulus while moving (1 = no scaling). */ scale_factor: { type: ParameterType.FLOAT, - pretty_name: "Stimulus scaling factor", default: 1.5, }, - /** The height in pixels of the container that subjects can move the stimuli in. */ + /** The height of the container that participants can move the stimuli in. Stimuli will be constrained to this area. */ sort_area_height: { type: ParameterType.INT, - pretty_name: "Sort area height", default: 700, }, - /** The width in pixels of the container that subjects can move the stimuli in. */ + /** The width of the container that participants can move the stimuli in. Stimuli will be constrained to this area. */ sort_area_width: { type: ParameterType.INT, - pretty_name: "Sort area width", default: 700, }, - /** The shape of the sorting area */ + /** The shape of the sorting area, can be "ellipse" or "square". */ sort_area_shape: { type: ParameterType.SELECT, - pretty_name: "Sort area shape", options: ["square", "ellipse"], default: "ellipse", }, - /** HTML to display above/below the sort area. It can be used to provide a reminder about the action the subject is supposed to take. */ + /** This string can contain HTML markup. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: "", }, - /** Indicates whether to show prompt "above" or "below" the sorting area. */ + /** Indicates whether to show the prompt `"above"` or `"below"` the sorting area. */ prompt_location: { type: ParameterType.SELECT, - pretty_name: "Prompt location", options: ["above", "below"], default: "above", }, /** The text that appears on the button to continue to the next trial. */ button_label: { type: ParameterType.STRING, - pretty_name: "Button label", default: "Continue", }, /** @@ -75,7 +69,6 @@ const info = { */ change_border_background_color: { type: ParameterType.BOOL, - pretty_name: "Change border background color", default: true, }, /** @@ -85,7 +78,6 @@ const info = { */ border_color_in: { type: ParameterType.STRING, - pretty_name: "Border color - in", default: "#a1d99b", }, /** @@ -94,13 +86,11 @@ const info = { */ border_color_out: { type: ParameterType.STRING, - pretty_name: "Border color - out", default: "#fc9272", }, /** The width in pixels of the border around the sort area. If null, the border width defaults to 3% of the sort area height. */ border_width: { type: ParameterType.INT, - pretty_name: "Border width", default: null, }, /** @@ -110,13 +100,11 @@ const info = { * */ counter_text_unfinished: { type: ParameterType.HTML_STRING, - pretty_name: "Counter text unfinished", default: "You still need to place %n% item%s% inside the sort area.", }, /** Text that will take the place of the counter_text_unfinished text when all items have been moved inside the sort area. */ counter_text_finished: { type: ParameterType.HTML_STRING, - pretty_name: "Counter text finished", default: "All items placed. Feel free to reposition items if necessary.", }, /** @@ -125,7 +113,6 @@ const info = { */ stim_starts_inside: { type: ParameterType.BOOL, - pretty_name: "Stim starts inside", default: false, }, /** @@ -134,21 +121,61 @@ const info = { */ column_spread_factor: { type: ParameterType.FLOAT, - pretty_name: "column spread factor", default: 1, }, }, + data: { + /** An array containing objects representing the initial locations of all the stimuli in the sorting area. Each element in the array represents a stimulus, and has a "src", "x", and "y" value. "src" is the image path, and "x" and "y" are the object location. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ + init_locations: { + type: ParameterType.STRING, + array: true, + }, + /** An array containing objects representing all of the moves the participant made when sorting. Each object represents a move. Each element in the array has a "src", "x", and "y" value. "src" is the image path, and "x" and "y" are the object location after the move. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ + moves: { + type: ParameterType.COMPLEX, + array: true, + parameters: { + src: { + type: ParameterType.STRING, + }, + x: { + type: ParameterType.INT, + }, + y: { + type: ParameterType.INT, + }, + }, + }, + /** An array containing objects representing the final locations of all the stimuli in the sorting area. Each element in the array represents a stimulus, and has a "src", "x", and "y" value. "src" is the image path, and "x" and "y" are the object location. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ + final_locations: { + type: ParameterType.COMPLEX, + array: true, + parameters: { + src: { + type: ParameterType.STRING, + }, + x: { + type: ParameterType.INT, + }, + y: { + type: ParameterType.INT, + }, + }, + }, + /** The response time in milliseconds for the participant to finish all sorting. */ + rt: { + type: ParameterType.INT, + }, + }, }; type Info = typeof info; /** - * **free-sort** - * - * jsPsych plugin for drag-and-drop sorting of a collection of images + * The free-sort plugin displays one or more images on the screen that the participant can interact with by clicking and dragging with a mouse, or touching and dragging with a touchscreen device. When the trial starts, the images can be positioned outside or inside the sort area. All images must be moved into the sorting area before the participant can click a button to end the trial. All of the moves that the participant performs are recorded, as well as the final positions of all images. This plugin could be useful when asking participants to position images based on similarity to one another, or to recall image spatial locations. * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-free-sort/ free-sort plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/free-sort/ free-sort plugin documentation on jspsych.org} */ class FreeSortPlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-fullscreen/src/index.ts b/packages/plugin-fullscreen/src/index.ts index 4978d8df1b..44642af0e7 100644 --- a/packages/plugin-fullscreen/src/index.ts +++ b/packages/plugin-fullscreen/src/index.ts @@ -1,49 +1,63 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "fullscreen", + version: version, parameters: { - /** If true, experiment will enter fullscreen mode. If false, the browser will exit fullscreen mode. */ + /** A value of `true` causes the experiment to enter fullscreen mode. A value of `false` causes the browser to exit fullscreen mode. */ fullscreen_mode: { type: ParameterType.BOOL, - pretty_name: "Fullscreen mode", default: true, array: false, }, - /** HTML content to display above the button to enter fullscreen mode */ + /** `

The experiment will switch to full screen mode when you press the button below

` | The HTML content to display above the button to enter fullscreen mode. */ message: { type: ParameterType.HTML_STRING, - pretty_name: "Message", default: "

The experiment will switch to full screen mode when you press the button below

", array: false, }, - /** The text that appears on the button to enter fullscreen */ + /** The text that appears on the button to enter fullscreen mode. */ button_label: { type: ParameterType.STRING, - pretty_name: "Button label", default: "Continue", array: false, }, - /** The length of time to delay after entering fullscreen mode before ending the trial. */ + /** The length of time to delay after entering fullscreen mode before ending the trial. This can be useful because entering fullscreen is jarring and most browsers display some kind of message that the browser has entered fullscreen mode. */ delay_after: { type: ParameterType.INT, - pretty_name: "Delay after", default: 1000, array: false, }, }, + data: { + /** true if the browser supports fullscreen mode (i.e., is not Safari) */ + success: { + type: ParameterType.BOOL, + default: null, + description: "True if the user entered fullscreen mode, false if not.", + }, + /** Response time to click the button that launches fullscreen mode */ + rt: { + type: ParameterType.INT, + default: null, + description: "Time in milliseconds until the user entered fullscreen mode.", + }, + }, }; type Info = typeof info; /** - * **fullscreen** + * The fullscreen plugin allows the experiment to enter or exit fullscreen mode. For security reasons, all browsers require that entry into fullscreen mode is triggered by a user action. To enter fullscreen mode, this plugin has the user click a button. Exiting fullscreen mode can be done without user input. * - * jsPsych plugin for toggling fullscreen mode in the browser + * !!! warning + * Safari does not support keyboard input when the browser is in fullscreen mode. Therefore, the function will not launch fullscreen mode on Safari. The experiment will ignore any trials using the fullscreen plugin in Safari. * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-fullscreen/ fullscreen plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/fullscreen/ fullscreen plugin documentation on jspsych.org} */ class FullscreenPlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-html-audio-response/src/index.ts b/packages/plugin-html-audio-response/src/index.ts index dfe602a78b..0a0de8bb16 100644 --- a/packages/plugin-html-audio-response/src/index.ts +++ b/packages/plugin-html-audio-response/src/index.ts @@ -1,63 +1,110 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "html-audio-response", + version: version, parameters: { - /** The HTML string to be displayed */ + /** The HTML content to be displayed. */ stimulus: { type: ParameterType.HTML_STRING, default: undefined, }, - /** How long to show the stimulus. */ + /** How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. */ stimulus_duration: { type: ParameterType.INT, default: null, }, - /** How long to show the trial. */ + /** The maximum length of the recording, in milliseconds. The default value is intentionally set low because of the potential to accidentally record very large data files if left too high. You can set this to `null` to allow the participant to control the length of the recording via the done button, but be careful with this option as it can lead to crashing the browser if the participant waits too long to stop the recording. */ recording_duration: { type: ParameterType.INT, default: 2000, }, - /** Whether or not to show a button to end the recording. If false, the recording_duration must be set. */ + /** Whether to show a button on the screen that the participant can click to finish the recording. */ show_done_button: { type: ParameterType.BOOL, default: true, }, - /** Label for the done (stop recording) button. Only used if show_done_button is true. */ + /** The label for the done button. */ done_button_label: { type: ParameterType.STRING, default: "Continue", }, - /** Label for the record again button (only used if allow_playback is true). */ + /** The label for the record again button enabled when `allow_playback: true`. + */ record_again_button_label: { type: ParameterType.STRING, default: "Record again", }, - /** Label for the button to accept the audio recording (only used if allow_playback is true). */ + /** The label for the accept button enabled when `allow_playback: true`. */ accept_button_label: { type: ParameterType.STRING, default: "Continue", }, - /** Whether or not to allow the participant to playback the recording and either accept or re-record. */ + /** Whether to allow the participant to listen to their recording and decide whether to rerecord or not. If `true`, then the participant will be shown an interface to play their recorded audio and click one of two buttons to either accept the recording or rerecord. If rerecord is selected, then stimulus will be shown again, as if the trial is starting again from the beginning. */ allow_playback: { type: ParameterType.BOOL, default: false, }, - /** Whether or not to save the video URL to the trial data. */ + /** If `true`, then an [Object URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) will be generated and stored for the recorded audio. Only set this to `true` if you plan to reuse the recorded audio later in the experiment, as it is a potentially memory-intensive feature. */ save_audio_url: { type: ParameterType.BOOL, default: false, }, }, + data: { + /** The time, since the onset of the stimulus, for the participant to click the done button. If the button is not clicked (or not enabled), then `rt` will be `null`. */ + rt: { + type: ParameterType.INT, + }, + /** The base64-encoded audio data. */ + response: { + type: ParameterType.STRING, + }, + /** The HTML content that was displayed on the screen. */ + stimulus: { + type: ParameterType.HTML_STRING, + }, + /** This is an estimate of when the stimulus appeared relative to the start of the audio recording. The plugin is configured so that the recording should start prior to the display of the stimulus. We have not yet been able to verify the accuracy of this estimate with external measurement devices. */ + estimated_stimulus_onset: { + type: ParameterType.INT, + }, + /** A URL to a copy of the audio data. */ + audio_url: { + type: ParameterType.STRING, + }, + }, }; type Info = typeof info; /** - * html-audio-response - * jsPsych plugin for displaying a stimulus and recording an audio response through a microphone + * This plugin displays HTML content and records audio from the participant via a microphone. + * + * In order to get access to the microphone, you need to use the [initialize-microphone plugin](initialize-microphone.md) on your timeline prior to using this plugin. + * Once access is granted for an experiment you do not need to get permission again. + * + * This plugin records audio data in [base 64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64). + * This is a text-based representation of the audio which can be coverted to various audio formats using a variety of [online tools](https://www.google.com/search?q=base64+audio+decoder) as well as in languages like python and R. + * + * **This plugin will generate a large amount of data, and you will need to be careful about how you handle this data.** + * Even a few seconds of audio recording will add 10s of kB to jsPsych's data. + * Multiply this by a handful (or more) of trials, and the data objects will quickly get large. + * If you need to record a lot of audio, either many trials worth or just a few trials with longer responses, we recommend that you save the data to your server immediately after the trial and delete the data in jsPsych's data object. + * See below for an example of how to do this. + * + * This plugin also provides the option to store the recorded audio files as [Object URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) via `save_audio_url: true`. + * This will generate a URL that is storing a copy of the recorded audio, which can be used for subsequent playback. + * See below for an example where the recorded audio is used as the stimulus in a subsequent trial. + * This feature is turned off by default because it uses a relatively large amount of memory compared to most jsPsych features. + * If you are running an experiment where you need this feature and you are recording lots of audio snippets, you may want to manually revoke the URLs when you no longer need them using [`URL.revokeObjectURL(objectURL)`](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL). + * + * !!! warning + * When recording from a microphone your experiment will need to be running over `https://` protocol. If you try to run the experiment locally using the `file://` protocol or over `http://` protocol you will not be able to access the microphone because of [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/). + * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-html-audio-response/ html-audio-response plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/html-audio-response/ html-audio-response plugin documentation on jspsych.org} */ class HtmlAudioResponsePlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-html-button-response/src/index.ts b/packages/plugin-html-button-response/src/index.ts index f3d0425e63..29740c28cd 100644 --- a/packages/plugin-html-button-response/src/index.ts +++ b/packages/plugin-html-button-response/src/index.ts @@ -1,95 +1,99 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "html-button-response", + version: version, parameters: { - /** The HTML string to be displayed */ + /** The HTML content to be displayed. */ stimulus: { type: ParameterType.HTML_STRING, - pretty_name: "Stimulus", default: undefined, }, - /** Array containing the label(s) for the button(s). */ + /** Labels for the buttons. Each different string in the array will generate a different button. */ choices: { type: ParameterType.STRING, - pretty_name: "Choices", default: undefined, array: true, }, /** - * A function that, given a choice and its index, returns the HTML string of that choice's - * button. + * A function that generates the HTML for each button in the `choices` array. The function gets the string and index of the item in the `choices` array and should return valid HTML. If you want to use different markup for each button, you can do that by using a conditional on either parameter. The default parameter returns a button element with the text label of the choice. */ button_html: { type: ParameterType.FUNCTION, - pretty_name: "Button HTML", default: function (choice: string, choice_index: number) { return ``; }, }, - /** Any content here will be displayed under the button(s). */ + /** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: null, }, - /** How long to show the stimulus. */ + /** How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. */ stimulus_duration: { type: ParameterType.INT, - pretty_name: "Stimulus duration", default: null, }, - /** How long to show the trial. */ + /** ow long to wait for the participant to make a response before ending the trial in milliseconds. If the participant fails to make a response before this timer is reached, the participant's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, the trial will wait for a response indefinitely. */ trial_duration: { type: ParameterType.INT, - pretty_name: "Trial duration", default: null, }, - /** The CSS layout for the buttons. Options: 'flex' or 'grid'. */ + /** Setting to `'grid'` will make the container element have the CSS property `display: grid` and enable the use of `grid_rows` and `grid_columns`. Setting to `'flex'` will make the container element have the CSS property `display: flex`. You can customize how the buttons are laid out by adding inline CSS in the `button_html` parameter. */ button_layout: { type: ParameterType.STRING, - pretty_name: "Button layout", default: "grid", }, - /** The number of grid rows when `button_layout` is "grid". - * Setting to `null` will infer the number of rows based on the - * number of columns and buttons. + /** + * The number of rows in the button grid. Only applicable when `button_layout` is set to `'grid'`. If null, the number of rows will be determined automatically based on the number of buttons and the number of columns. */ grid_rows: { type: ParameterType.INT, - pretty_name: "Grid rows", default: 1, }, - /** The number of grid columns when `button_layout` is "grid". - * Setting to `null` (default value) will infer the number of columns - * based on the number of rows and buttons. */ + /** + * The number of columns in the button grid. Only applicable when `button_layout` is set to `'grid'`. If null, the number of columns will be determined automatically based on the number of buttons and the number of rows. + */ grid_columns: { type: ParameterType.INT, - pretty_name: "Grid columns", default: null, }, - /** If true, then trial will end when user responds. */ + /** If true, then the trial will end whenever the participant makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete. */ response_ends_trial: { type: ParameterType.BOOL, - pretty_name: "Response ends trial", default: true, }, - /** The delay of enabling button */ + /** How long the button will delay enabling in milliseconds. */ enable_button_after: { type: ParameterType.INT, - pretty_name: "Enable button after", default: 0, }, }, + data: { + /** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */ + rt: { + type: ParameterType.INT, + }, + /** Indicates which button the participant pressed. The first button in the `choices` array is 0, the second is 1, and so on. */ + response: { + type: ParameterType.INT, + }, + /** The HTML content that was displayed on the screen. */ + stimulus: { + type: ParameterType.HTML_STRING, + }, + }, }; type Info = typeof info; /** - * html-button-response - * jsPsych plugin for displaying a stimulus and getting a button response + * This plugin displays HTML content and records responses generated by button click. The stimulus can be displayed until a response is given, or for a pre-determined amount of time. The trial can be ended automatically if the participant has failed to respond within a fixed length of time. The button itself can be customized using HTML formatting. + * * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-html-button-response/ html-button-response plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/html-button-response/ html-button-response plugin documentation on jspsych.org} */ class HtmlButtonResponsePlugin implements JsPsychPlugin { static info = info; diff --git a/packages/plugin-html-slider-response/src/index.ts b/packages/plugin-html-slider-response/src/index.ts index e78ace505e..392ed6040b 100644 --- a/packages/plugin-html-slider-response/src/index.ts +++ b/packages/plugin-html-slider-response/src/index.ts @@ -1,100 +1,105 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; +import { version } from "../package.json"; + const info = { name: "html-slider-response", + version: version, parameters: { /** The HTML string to be displayed */ stimulus: { type: ParameterType.HTML_STRING, - pretty_name: "Stimulus", default: undefined, }, /** Sets the minimum value of the slider. */ min: { type: ParameterType.INT, - pretty_name: "Min slider", default: 0, }, /** Sets the maximum value of the slider */ max: { type: ParameterType.INT, - pretty_name: "Max slider", default: 100, }, /** Sets the starting value of the slider */ slider_start: { type: ParameterType.INT, - pretty_name: "Slider starting value", default: 50, }, - /** Sets the step of the slider */ + /** Sets the step of the slider. This is the smallest amount by which the slider can change. */ step: { type: ParameterType.INT, - pretty_name: "Step", default: 1, }, - /** Array containing the labels for the slider. Labels will be displayed at equidistant locations along the slider. */ + /** Labels displayed at equidistant locations on the slider. For example, two labels will be placed at the ends of the slider. Three labels would place two at the ends and one in the middle. Four will place two at the ends, and the other two will be at 33% and 67% of the slider width. */ labels: { type: ParameterType.HTML_STRING, - pretty_name: "Labels", default: [], array: true, }, - /** Width of the slider in pixels. */ + /** Set the width of the slider in pixels. If left null, then the width will be equal to the widest element in the display. */ slider_width: { type: ParameterType.INT, - pretty_name: "Slider width", default: null, }, - /** Label of the button to advance. */ + /** Label of the button to end the trial. */ button_label: { type: ParameterType.STRING, - pretty_name: "Button label", default: "Continue", array: false, }, - /** If true, the participant will have to move the slider before continuing. */ + /** If true, the participant must move the slider before clicking the continue button. */ require_movement: { type: ParameterType.BOOL, - pretty_name: "Require movement", default: false, }, - /** Any content here will be displayed below the slider. */ + /** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */ prompt: { type: ParameterType.HTML_STRING, - pretty_name: "Prompt", default: null, }, - /** How long to show the stimulus. */ + /** How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. */ stimulus_duration: { type: ParameterType.INT, - pretty_name: "Stimulus duration", default: null, }, - /** How long to show the trial. */ + /** How long to wait for the participant to make a response before ending the trial in milliseconds. If the participant fails to make a response before this timer is reached, the participant's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. */ trial_duration: { type: ParameterType.INT, - pretty_name: "Trial duration", default: null, }, - /** If true, trial will end when user makes a response. */ + /** If true, then the trial will end whenever the participant makes a response (assuming they make their response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for `trial_duration` is reached. You can set this parameter to `false` to force the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete. */ response_ends_trial: { type: ParameterType.BOOL, - pretty_name: "Response ends trial", default: true, }, }, + data: { + /** The time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */ + rt: { + type: ParameterType.INT, + }, + /** The numeric value of the slider. */ + response: { + type: ParameterType.INT, + }, + /** The HTML content that was displayed on the screen. */ + stimulus: { + type: ParameterType.HTML_STRING, + }, + /** The starting value of the slider. */ + slider_start: { + type: ParameterType.INT, + }, + }, }; type Info = typeof info; /** - * **html-slider-response** - * - * jsPsych plugin for showing an HTML stimulus and collecting a slider response - * + * This plugin displays HTML content and allows the participant to respond by dragging a slider. * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-html-slider-response/ html-slider-response plugin documentation on jspsych.org} + * @see {@link https://www.jspsych.org/latest/plugins/html-slider-response/ html-slider-response plugin documentation on jspsych.org} */ class HtmlSliderResponsePlugin implements JsPsychPlugin { static info = info;