Skip to content

Commit e571bcd

Browse files
committed
add type to docStrings;
1 parent b4d824e commit e571bcd

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

packages/hearts-and-flowers/src/index.ts

+28-27
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ const DEFAULT_STIMULUS_INFO_OBJECT: IStimulusInfo = {
3737
/**
3838
* Generates the stimulus HTML for a given trial.
3939
*
40-
* @param targetSide The side of the target stimulus [same|opposite].
41-
* @param stimulusSide The side of the stimulus to be displayed [left|right].
42-
* @param stimulusInfo The stimulus information object that describes the name
40+
* @param {"same" | "opposite"} targetSide - The side of the target stimulus [same|opposite].
41+
* @param {"left" | "right"} stimulusSide - The side of the stimulus to be displayed [left|right].
42+
* @param {object} stimulusInfo - The stimulus information object that describes the name
4343
* of the stimulus and its source.
44-
* @param instruction Whether to include instruction text teaching participants
44+
* @param {boolean} instruction - Whether to include instruction text teaching participants
4545
* how to respond or not.
46-
* @returns HTML string representing the stimulus.
46+
* @returns {string} HTML string representing the stimulus.
4747
*/
4848
function generateStimulus(
4949
targetSide: keyof IStimulusInfo,
@@ -73,9 +73,9 @@ function generateStimulus(
7373
/**
7474
* Computes the correct response index.
7575
*
76-
* @param targetSide The side of the target stimulus [same|opposite].
77-
* @param stimulusSide The side of the stimulus to be displayed [left|right].
78-
* @returns The correct response index.
76+
* @param {"same" | "opposite"} targetSide - The side of the target stimulus [same|opposite].
77+
* @param {"left" | "right"} stimulusSide - The side of the stimulus to be displayed [left|right].
78+
* @returns {number} The correct response index.
7979
*/
8080
function getCorrectResponse(targetSide: keyof IStimulusInfo, stimulusSide: "left" | "right") {
8181
return targetSide === "same"
@@ -90,8 +90,8 @@ function getCorrectResponse(targetSide: keyof IStimulusInfo, stimulusSide: "left
9090
/**
9191
* Trial that announces the demo game type.
9292
*
93-
* @param stimulusName The name of the stimulus to be demoed
94-
* @returns jsPsychHtmlButtonResponse object displaying the name of the stimulus
93+
* @param {string} stimulusName - The name of the stimulus to be demoed.
94+
* @returns {object} jsPsychHtmlButtonResponse object displaying the name of the stimulus
9595
* to be demoed.
9696
*/
9797
function createGametypeTrial(stimulusName: string) {
@@ -108,12 +108,12 @@ function createGametypeTrial(stimulusName: string) {
108108
/**
109109
* Trial that shows the stimulus and collects the response.
110110
*
111-
* @param jsPsych The jsPsych object that runs the experiment.
112-
* @param stimulusInfo The stimulus information object that describes the name
111+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
112+
* @param {object} stimulusInfo - The stimulus information object that describes the name
113113
* of the stimulus and its source.
114-
* @param instruction Whether to include instruction text teaching participants
114+
* @param {boolean} instruction - Whether to include instruction text teaching participants
115115
* how to respond or not.
116-
* @returns jsPsychHtmlButtonResponse object displaying the stimulus and collecting
116+
* @returns {object} jsPsychHtmlButtonResponse object displaying the stimulus and collecting
117117
* the response.
118118
*/
119119
function createTrial(jsPsych: JsPsych, stimulusInfo: IStimulusInfo, instruction: boolean = false) {
@@ -149,8 +149,8 @@ function createTrial(jsPsych: JsPsych, stimulusInfo: IStimulusInfo, instruction:
149149
/**
150150
* Trial that shows feedback after each demo trial.
151151
*
152-
* @param jsPsych The jsPsych object that runs the experiment.
153-
* @returns jsPsychHtmlKeyboardResponse object displaying feedback after each
152+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
153+
* @returns {object} jsPsychHtmlKeyboardResponse object displaying feedback after each
154154
* demo trial that depends on whether the participant answered correctly.
155155
*
156156
*/
@@ -175,8 +175,8 @@ function createFeedbackTrial(jsPsych: JsPsych) {
175175
/**
176176
* Trial that shows a fixation cross.
177177
*
178-
* @param jsPsych The jsPsych object that runs the experiment.
179-
* @returns jsPsychHtmlKeyboardResponse object displaying a fixation cross for a
178+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
179+
* @returns {object} jsPsychHtmlKeyboardResponse object displaying a fixation cross for a
180180
* random duration.
181181
*/
182182
function createFixationTrial(jsPsych: JsPsych, fixationDurationFunction: () => number) {
@@ -196,11 +196,11 @@ function createFixationTrial(jsPsych: JsPsych, fixationDurationFunction: () => n
196196
/**
197197
* Creates a demo subtimeline.
198198
*
199-
* @param jsPsych The jsPsych object that runs the experiment.
200-
* @param targetSide The side of the target stimulus [same|opposite|both].
201-
* @param stimulusInfo The stimulus information object that describes the name
199+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
200+
* @param {"same" | "opposite" | "both"} targetSide - The side of the target stimulus.
201+
* @param {object} stimulusInfo - The stimulus information object that describes the name
202202
* of the stimulus and its source.
203-
* @returns A subtimeline that includes a demo trial with stimulus on the left,
203+
* @returns {Array} A subtimeline that includes a demo trial with stimulus on the left,
204204
* a demo trial with stimulus on the right, or both.
205205
*/
206206
function createDemoSubTimeline(
@@ -250,14 +250,14 @@ function createDemoSubTimeline(
250250
/**
251251
* Creates a subtimeline with a set number of trials.
252252
*
253-
* @param jsPsych The jsPsych object that runs the experiment.
254-
* @param options The options object that includes what kinds of trials to
253+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
254+
* @param {object} options - The options object that includes what kinds of trials to
255255
* include [same|opposte|both], the number of trials, the weights for how often
256256
* each type of stimulus appears, the weights for how often the stimulus appears on
257257
* each side, and the stimulus information containing the name and source of each
258258
* stimulus type.
259259
*
260-
* @returns A subtimeline with a set number of trials with the specified options.
260+
* @returns {Array} A subtimeline with a set number of trials with the specified options.
261261
*/
262262
function createTrialsSubTimeline(
263263
jsPsych: JsPsych,
@@ -326,12 +326,13 @@ function createTrialsSubTimeline(
326326
/**
327327
* Creates the main timeline.
328328
*
329-
* @param jsPsych The jsPsych object that runs the experiment.
330-
* @param options The options object that includes the number of trials, the weights
329+
* @param {object} jsPsych - The jsPsych object that runs the experiment.
330+
* @param {object} options - The options object that includes the number of trials, the weights
331331
* for how often each type of stimulus appears, the weights for how often the stimulus
332332
* appears on each side, the stimulus information containing the name and source
333333
* of each stimulus type, whether to include a demo section or not, and the instruction
334334
* text at the beginning and end of the experiment.
335+
* @returns {object} The main timeline object.
335336
*/
336337
export function createTimeline(
337338
jsPsych: JsPsych,

0 commit comments

Comments
 (0)