@jspsych/plugin-html-keyboard-response 1.1.3 → 2.1.0

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.cjs CHANGED
@@ -2,172 +2,182 @@
2
2
 
3
3
  var jspsych = require('jspsych');
4
4
 
5
+ var version = "2.1.0";
6
+
5
7
  const info = {
6
- name: "html-keyboard-response",
7
- parameters: {
8
- /**
9
- * The HTML string to be displayed.
10
- */
11
- stimulus: {
12
- type: jspsych.ParameterType.HTML_STRING,
13
- pretty_name: "Stimulus",
14
- default: undefined,
15
- },
16
- /**
17
- * Array containing the key(s) the subject is allowed to press to respond to the stimulus.
18
- */
19
- choices: {
20
- type: jspsych.ParameterType.KEYS,
21
- pretty_name: "Choices",
22
- default: "ALL_KEYS",
23
- },
24
- /**
25
- * Any content here will be displayed below the stimulus.
26
- */
27
- prompt: {
28
- type: jspsych.ParameterType.HTML_STRING,
29
- pretty_name: "Prompt",
30
- default: null,
31
- },
32
- /**
33
- * How long to show the stimulus.
34
- */
35
- stimulus_duration: {
36
- type: jspsych.ParameterType.INT,
37
- pretty_name: "Stimulus duration",
38
- default: null,
39
- },
40
- /**
41
- * How long to show trial before it ends.
42
- */
43
- trial_duration: {
44
- type: jspsych.ParameterType.INT,
45
- pretty_name: "Trial duration",
46
- default: null,
47
- },
48
- /**
49
- * If true, trial will end when subject makes a response.
50
- */
51
- response_ends_trial: {
52
- type: jspsych.ParameterType.BOOL,
53
- pretty_name: "Response ends trial",
54
- default: true,
55
- },
8
+ name: "html-keyboard-response",
9
+ version,
10
+ parameters: {
11
+ /**
12
+ * The string to be displayed.
13
+ */
14
+ stimulus: {
15
+ type: jspsych.ParameterType.HTML_STRING,
16
+ default: void 0
17
+ },
18
+ /**
19
+ * This array contains the key(s) that the participant is allowed to press in order to respond
20
+ * to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see
21
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values this page}
22
+ * and
23
+ * {@link https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/ this page (event.key column)}
24
+ * for more examples. Any key presses that are not listed in the
25
+ * array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses.
26
+ * Specifying `"NO_KEYS"` will mean that no responses are allowed.
27
+ */
28
+ choices: {
29
+ type: jspsych.ParameterType.KEYS,
30
+ default: "ALL_KEYS"
31
+ },
32
+ /**
33
+ * This string can contain HTML markup. Any content here will be displayed below the stimulus.
34
+ * The intention is that it can be used to provide a reminder about the action the participant
35
+ * is supposed to take (e.g., which key to press).
36
+ */
37
+ prompt: {
38
+ type: jspsych.ParameterType.HTML_STRING,
39
+ default: null
40
+ },
41
+ /**
42
+ * How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus
43
+ * will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will
44
+ * remain visible until the trial ends.
45
+ */
46
+ stimulus_duration: {
47
+ type: jspsych.ParameterType.INT,
48
+ default: null
49
+ },
50
+ /**
51
+ * How long to wait for the participant to make a response before ending the trial in milliseconds.
52
+ * If the participant fails to make a response before this timer is reached, the participant's response
53
+ * will be recorded as null for the trial and the trial will end. If the value of this parameter is null,
54
+ * then the trial will wait for a response indefinitely.
55
+ */
56
+ trial_duration: {
57
+ type: jspsych.ParameterType.INT,
58
+ default: null
56
59
  },
60
+ /**
61
+ * If true, then the trial will end whenever the participant makes a response (assuming they make their
62
+ * response before the cutoff specified by the trial_duration parameter). If false, then the trial will
63
+ * continue until the value for trial_duration is reached. You can set this parameter to false to force
64
+ * the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete.
65
+ */
66
+ response_ends_trial: {
67
+ type: jspsych.ParameterType.BOOL,
68
+ default: true
69
+ }
70
+ },
71
+ data: {
72
+ /** Indicates which key the participant pressed. */
73
+ response: {
74
+ type: jspsych.ParameterType.STRING
75
+ },
76
+ /** 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. */
77
+ rt: {
78
+ type: jspsych.ParameterType.INT
79
+ },
80
+ /** The HTML content that was displayed on the screen. */
81
+ stimulus: {
82
+ type: jspsych.ParameterType.STRING
83
+ }
84
+ },
85
+ // prettier-ignore
86
+ citations: {
87
+ "apa": "de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ",
88
+ "bibtex": '@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } '
89
+ }
57
90
  };
58
- /**
59
- * **html-keyboard-response**
60
- *
61
- * jsPsych plugin for displaying a stimulus and getting a keyboard response
62
- *
63
- * @author Josh de Leeuw
64
- * @see {@link https://www.jspsych.org/plugins/jspsych-html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}
65
- */
66
91
  class HtmlKeyboardResponsePlugin {
67
- constructor(jsPsych) {
68
- this.jsPsych = jsPsych;
92
+ constructor(jsPsych) {
93
+ this.jsPsych = jsPsych;
94
+ }
95
+ static {
96
+ this.info = info;
97
+ }
98
+ trial(display_element, trial) {
99
+ var new_html = '<div id="jspsych-html-keyboard-response-stimulus">' + trial.stimulus + "</div>";
100
+ if (trial.prompt !== null) {
101
+ new_html += trial.prompt;
102
+ }
103
+ display_element.innerHTML = new_html;
104
+ var response = {
105
+ rt: null,
106
+ key: null
107
+ };
108
+ const end_trial = () => {
109
+ if (typeof keyboardListener !== "undefined") {
110
+ this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
111
+ }
112
+ var trial_data = {
113
+ rt: response.rt,
114
+ stimulus: trial.stimulus,
115
+ response: response.key
116
+ };
117
+ this.jsPsych.finishTrial(trial_data);
118
+ };
119
+ var after_response = (info2) => {
120
+ display_element.querySelector("#jspsych-html-keyboard-response-stimulus").className += " responded";
121
+ if (response.key == null) {
122
+ response = info2;
123
+ }
124
+ if (trial.response_ends_trial) {
125
+ end_trial();
126
+ }
127
+ };
128
+ if (trial.choices != "NO_KEYS") {
129
+ var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({
130
+ callback_function: after_response,
131
+ valid_responses: trial.choices,
132
+ rt_method: "performance",
133
+ persist: false,
134
+ allow_held_key: false
135
+ });
69
136
  }
70
- trial(display_element, trial) {
71
- var new_html = '<div id="jspsych-html-keyboard-response-stimulus">' + trial.stimulus + "</div>";
72
- // add prompt
73
- if (trial.prompt !== null) {
74
- new_html += trial.prompt;
75
- }
76
- // draw
77
- display_element.innerHTML = new_html;
78
- // store response
79
- var response = {
80
- rt: null,
81
- key: null,
82
- };
83
- // function to end trial when it is time
84
- const end_trial = () => {
85
- // kill any remaining setTimeout handlers
86
- this.jsPsych.pluginAPI.clearAllTimeouts();
87
- // kill keyboard listeners
88
- if (typeof keyboardListener !== "undefined") {
89
- this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
90
- }
91
- // gather the data to store for the trial
92
- var trial_data = {
93
- rt: response.rt,
94
- stimulus: trial.stimulus,
95
- response: response.key,
96
- };
97
- // clear the display
98
- display_element.innerHTML = "";
99
- // move on to the next trial
100
- this.jsPsych.finishTrial(trial_data);
101
- };
102
- // function to handle responses by the subject
103
- var after_response = (info) => {
104
- // after a valid response, the stimulus will have the CSS class 'responded'
105
- // which can be used to provide visual feedback that a response was recorded
106
- display_element.querySelector("#jspsych-html-keyboard-response-stimulus").className +=
107
- " responded";
108
- // only record the first response
109
- if (response.key == null) {
110
- response = info;
111
- }
112
- if (trial.response_ends_trial) {
113
- end_trial();
114
- }
115
- };
116
- // start the response listener
117
- if (trial.choices != "NO_KEYS") {
118
- var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({
119
- callback_function: after_response,
120
- valid_responses: trial.choices,
121
- rt_method: "performance",
122
- persist: false,
123
- allow_held_key: false,
124
- });
125
- }
126
- // hide stimulus if stimulus_duration is set
127
- if (trial.stimulus_duration !== null) {
128
- this.jsPsych.pluginAPI.setTimeout(() => {
129
- display_element.querySelector("#jspsych-html-keyboard-response-stimulus").style.visibility = "hidden";
130
- }, trial.stimulus_duration);
131
- }
132
- // end trial if trial_duration is set
133
- if (trial.trial_duration !== null) {
134
- this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);
135
- }
137
+ if (trial.stimulus_duration !== null) {
138
+ this.jsPsych.pluginAPI.setTimeout(() => {
139
+ display_element.querySelector(
140
+ "#jspsych-html-keyboard-response-stimulus"
141
+ ).style.visibility = "hidden";
142
+ }, trial.stimulus_duration);
136
143
  }
137
- simulate(trial, simulation_mode, simulation_options, load_callback) {
138
- if (simulation_mode == "data-only") {
139
- load_callback();
140
- this.simulate_data_only(trial, simulation_options);
141
- }
142
- if (simulation_mode == "visual") {
143
- this.simulate_visual(trial, simulation_options, load_callback);
144
- }
144
+ if (trial.trial_duration !== null) {
145
+ this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);
145
146
  }
146
- create_simulation_data(trial, simulation_options) {
147
- const default_data = {
148
- stimulus: trial.stimulus,
149
- rt: this.jsPsych.randomization.sampleExGaussian(500, 50, 1 / 150, true),
150
- response: this.jsPsych.pluginAPI.getValidKey(trial.choices),
151
- };
152
- const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);
153
- this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);
154
- return data;
147
+ }
148
+ simulate(trial, simulation_mode, simulation_options, load_callback) {
149
+ if (simulation_mode == "data-only") {
150
+ load_callback();
151
+ this.simulate_data_only(trial, simulation_options);
155
152
  }
156
- simulate_data_only(trial, simulation_options) {
157
- const data = this.create_simulation_data(trial, simulation_options);
158
- this.jsPsych.finishTrial(data);
153
+ if (simulation_mode == "visual") {
154
+ this.simulate_visual(trial, simulation_options, load_callback);
159
155
  }
160
- simulate_visual(trial, simulation_options, load_callback) {
161
- const data = this.create_simulation_data(trial, simulation_options);
162
- const display_element = this.jsPsych.getDisplayElement();
163
- this.trial(display_element, trial);
164
- load_callback();
165
- if (data.rt !== null) {
166
- this.jsPsych.pluginAPI.pressKey(data.response, data.rt);
167
- }
156
+ }
157
+ create_simulation_data(trial, simulation_options) {
158
+ const default_data = {
159
+ stimulus: trial.stimulus,
160
+ rt: this.jsPsych.randomization.sampleExGaussian(500, 50, 1 / 150, true),
161
+ response: this.jsPsych.pluginAPI.getValidKey(trial.choices)
162
+ };
163
+ const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);
164
+ this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);
165
+ return data;
166
+ }
167
+ simulate_data_only(trial, simulation_options) {
168
+ const data = this.create_simulation_data(trial, simulation_options);
169
+ this.jsPsych.finishTrial(data);
170
+ }
171
+ simulate_visual(trial, simulation_options, load_callback) {
172
+ const data = this.create_simulation_data(trial, simulation_options);
173
+ const display_element = this.jsPsych.getDisplayElement();
174
+ this.trial(display_element, trial);
175
+ load_callback();
176
+ if (data.rt !== null) {
177
+ this.jsPsych.pluginAPI.pressKey(data.response, data.rt);
168
178
  }
179
+ }
169
180
  }
170
- HtmlKeyboardResponsePlugin.info = info;
171
181
 
172
182
  module.exports = HtmlKeyboardResponsePlugin;
173
183
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from \"jspsych\";\n\nconst info = <const>{\n name: \"html-keyboard-response\",\n parameters: {\n /**\n * The HTML string to be displayed.\n */\n stimulus: {\n type: ParameterType.HTML_STRING,\n pretty_name: \"Stimulus\",\n default: undefined,\n },\n /**\n * Array containing the key(s) the subject is allowed to press to respond to the stimulus.\n */\n choices: {\n type: ParameterType.KEYS,\n pretty_name: \"Choices\",\n default: \"ALL_KEYS\",\n },\n /**\n * Any content here will be displayed below the stimulus.\n */\n prompt: {\n type: ParameterType.HTML_STRING,\n pretty_name: \"Prompt\",\n default: null,\n },\n /**\n * How long to show the stimulus.\n */\n stimulus_duration: {\n type: ParameterType.INT,\n pretty_name: \"Stimulus duration\",\n default: null,\n },\n /**\n * How long to show trial before it ends.\n */\n trial_duration: {\n type: ParameterType.INT,\n pretty_name: \"Trial duration\",\n default: null,\n },\n /**\n * If true, trial will end when subject makes a response.\n */\n response_ends_trial: {\n type: ParameterType.BOOL,\n pretty_name: \"Response ends trial\",\n default: true,\n },\n },\n};\n\ntype Info = typeof info;\n\n/**\n * **html-keyboard-response**\n *\n * jsPsych plugin for displaying a stimulus and getting a keyboard response\n *\n * @author Josh de Leeuw\n * @see {@link https://www.jspsych.org/plugins/jspsych-html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}\n */\nclass HtmlKeyboardResponsePlugin implements JsPsychPlugin<Info> {\n static info = info;\n\n constructor(private jsPsych: JsPsych) {}\n\n trial(display_element: HTMLElement, trial: TrialType<Info>) {\n var new_html = '<div id=\"jspsych-html-keyboard-response-stimulus\">' + trial.stimulus + \"</div>\";\n\n // add prompt\n if (trial.prompt !== null) {\n new_html += trial.prompt;\n }\n\n // draw\n display_element.innerHTML = new_html;\n\n // store response\n var response = {\n rt: null,\n key: null,\n };\n\n // function to end trial when it is time\n const end_trial = () => {\n // kill any remaining setTimeout handlers\n this.jsPsych.pluginAPI.clearAllTimeouts();\n\n // kill keyboard listeners\n if (typeof keyboardListener !== \"undefined\") {\n this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);\n }\n\n // gather the data to store for the trial\n var trial_data = {\n rt: response.rt,\n stimulus: trial.stimulus,\n response: response.key,\n };\n\n // clear the display\n display_element.innerHTML = \"\";\n\n // move on to the next trial\n this.jsPsych.finishTrial(trial_data);\n };\n\n // function to handle responses by the subject\n var after_response = (info) => {\n // after a valid response, the stimulus will have the CSS class 'responded'\n // which can be used to provide visual feedback that a response was recorded\n display_element.querySelector(\"#jspsych-html-keyboard-response-stimulus\").className +=\n \" responded\";\n\n // only record the first response\n if (response.key == null) {\n response = info;\n }\n\n if (trial.response_ends_trial) {\n end_trial();\n }\n };\n\n // start the response listener\n if (trial.choices != \"NO_KEYS\") {\n var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({\n callback_function: after_response,\n valid_responses: trial.choices,\n rt_method: \"performance\",\n persist: false,\n allow_held_key: false,\n });\n }\n\n // hide stimulus if stimulus_duration is set\n if (trial.stimulus_duration !== null) {\n this.jsPsych.pluginAPI.setTimeout(() => {\n display_element.querySelector<HTMLElement>(\n \"#jspsych-html-keyboard-response-stimulus\"\n ).style.visibility = \"hidden\";\n }, trial.stimulus_duration);\n }\n\n // end trial if trial_duration is set\n if (trial.trial_duration !== null) {\n this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);\n }\n }\n\n simulate(\n trial: TrialType<Info>,\n simulation_mode,\n simulation_options: any,\n load_callback: () => void\n ) {\n if (simulation_mode == \"data-only\") {\n load_callback();\n this.simulate_data_only(trial, simulation_options);\n }\n if (simulation_mode == \"visual\") {\n this.simulate_visual(trial, simulation_options, load_callback);\n }\n }\n\n private create_simulation_data(trial: TrialType<Info>, simulation_options) {\n const default_data = {\n stimulus: trial.stimulus,\n rt: this.jsPsych.randomization.sampleExGaussian(500, 50, 1 / 150, true),\n response: this.jsPsych.pluginAPI.getValidKey(trial.choices),\n };\n\n const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);\n\n this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);\n\n return data;\n }\n\n private simulate_data_only(trial: TrialType<Info>, simulation_options) {\n const data = this.create_simulation_data(trial, simulation_options);\n\n this.jsPsych.finishTrial(data);\n }\n\n private simulate_visual(trial: TrialType<Info>, simulation_options, load_callback: () => void) {\n const data = this.create_simulation_data(trial, simulation_options);\n\n const display_element = this.jsPsych.getDisplayElement();\n\n this.trial(display_element, trial);\n load_callback();\n\n if (data.rt !== null) {\n this.jsPsych.pluginAPI.pressKey(data.response, data.rt);\n }\n }\n}\n\nexport default HtmlKeyboardResponsePlugin;\n"],"names":["ParameterType"],"mappings":";;;;AAEA,MAAM,IAAI,GAAU;AAClB,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,UAAU,EAAE;AACV;;AAEG;AACH,QAAA,QAAQ,EAAE;YACR,IAAI,EAAEA,qBAAa,CAAC,WAAW;AAC/B,YAAA,WAAW,EAAE,UAAU;AACvB,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD;;AAEG;AACH,QAAA,OAAO,EAAE;YACP,IAAI,EAAEA,qBAAa,CAAC,IAAI;AACxB,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,OAAO,EAAE,UAAU;AACpB,SAAA;AACD;;AAEG;AACH,QAAA,MAAM,EAAE;YACN,IAAI,EAAEA,qBAAa,CAAC,WAAW;AAC/B,YAAA,WAAW,EAAE,QAAQ;AACrB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEG;AACH,QAAA,iBAAiB,EAAE;YACjB,IAAI,EAAEA,qBAAa,CAAC,GAAG;AACvB,YAAA,WAAW,EAAE,mBAAmB;AAChC,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEG;AACH,QAAA,cAAc,EAAE;YACd,IAAI,EAAEA,qBAAa,CAAC,GAAG;AACvB,YAAA,WAAW,EAAE,gBAAgB;AAC7B,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEG;AACH,QAAA,mBAAmB,EAAE;YACnB,IAAI,EAAEA,qBAAa,CAAC,IAAI;AACxB,YAAA,WAAW,EAAE,qBAAqB;AAClC,YAAA,OAAO,EAAE,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CAAC;AAEhB,QAAA,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;AACpB,YAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AACzD,SAAA;KACF;;AAtIM,0BAAI,CAAA,IAAA,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@jspsych/plugin-html-keyboard-response\",\n \"version\": \"2.1.0\",\n \"description\": \"jsPsych plugin for displaying a stimulus and getting a keyboard response\",\n \"type\": \"module\",\n \"main\": \"dist/index.cjs\",\n \"exports\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"typings\": \"dist/index.d.ts\",\n \"unpkg\": \"dist/index.browser.min.js\",\n \"files\": [\n \"src\",\n \"dist\"\n ],\n \"source\": \"src/index.ts\",\n \"scripts\": {\n \"test\": \"jest\",\n \"test:watch\": \"npm test -- --watch\",\n \"tsc\": \"tsc\",\n \"build\": \"rollup --config\",\n \"build:watch\": \"npm run build -- --watch\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/jspsych/jsPsych.git\",\n \"directory\": \"packages/plugin-html-keyboard-response\"\n },\n \"author\": \"Josh de Leeuw\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/jspsych/jsPsych/issues\"\n },\n \"homepage\": \"https://www.jspsych.org/latest/plugins/html-keyboard-response\",\n \"peerDependencies\": {\n \"jspsych\": \">=7.1.0\"\n },\n \"devDependencies\": {\n \"@jspsych/config\": \"^3.2.0\",\n \"@jspsych/test-utils\": \"^1.2.0\"\n }\n}\n","import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from \"jspsych\";\n\nimport { version } from \"../package.json\";\n\nconst info = <const>{\n name: \"html-keyboard-response\",\n version: version,\n parameters: {\n /**\n * The string to be displayed.\n */\n stimulus: {\n type: ParameterType.HTML_STRING,\n default: undefined,\n },\n /**\n * This array contains the key(s) that the participant is allowed to press in order to respond\n * to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values this page}\n * and\n * {@link https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/ this page (event.key column)}\n * for more examples. Any key presses that are not listed in the\n * array will be ignored. The default value of `\"ALL_KEYS\"` means that all keys will be accepted as valid responses.\n * Specifying `\"NO_KEYS\"` will mean that no responses are allowed.\n */\n choices: {\n type: ParameterType.KEYS,\n default: \"ALL_KEYS\",\n },\n /**\n * This string can contain HTML markup. Any content here will be displayed below the stimulus.\n * The intention is that it can be used to provide a reminder about the action the participant\n * is supposed to take (e.g., which key to press).\n */\n prompt: {\n type: ParameterType.HTML_STRING,\n default: null,\n },\n /**\n * How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus\n * will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will\n * remain visible until the trial ends.\n */\n stimulus_duration: {\n type: ParameterType.INT,\n default: null,\n },\n /**\n * How long to wait for the participant to make a response before ending the trial in milliseconds.\n * If the participant fails to make a response before this timer is reached, the participant's response\n * will be recorded as null for the trial and the trial will end. If the value of this parameter is null,\n * then the trial will wait for a response indefinitely.\n */\n trial_duration: {\n type: ParameterType.INT,\n default: null,\n },\n /**\n * If true, then the trial will end whenever the participant makes a response (assuming they make their\n * response before the cutoff specified by the trial_duration parameter). If false, then the trial will\n * continue until the value for trial_duration is reached. You can set this parameter to false to force\n * the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete.\n */\n response_ends_trial: {\n type: ParameterType.BOOL,\n default: true,\n },\n },\n data: {\n /** Indicates which key the participant pressed. */\n response: {\n type: ParameterType.STRING,\n },\n /** 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. */\n rt: {\n type: ParameterType.INT,\n },\n /** The HTML content that was displayed on the screen. */\n stimulus: {\n type: ParameterType.STRING,\n },\n },\n // prettier-ignore\n citations: '__CITATIONS__',\n};\n\ntype Info = typeof info;\n\n/**\n * This plugin displays HTML content and records responses generated with the keyboard.\n * The stimulus can be displayed until a response is given, or for a pre-determined amount of time.\n * The trial can be ended automatically if the participant has failed to respond within a fixed length of time.\n *\n * @author Josh de Leeuw\n * @see {@link https://www.jspsych.org/latest/plugins/html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}\n */\nclass HtmlKeyboardResponsePlugin implements JsPsychPlugin<Info> {\n static info = info;\n constructor(private jsPsych: JsPsych) {}\n\n trial(display_element: HTMLElement, trial: TrialType<Info>) {\n var new_html = '<div id=\"jspsych-html-keyboard-response-stimulus\">' + trial.stimulus + \"</div>\";\n\n // add prompt\n if (trial.prompt !== null) {\n new_html += trial.prompt;\n }\n\n // draw\n display_element.innerHTML = new_html;\n\n // store response\n var response = {\n rt: null,\n key: null,\n };\n\n // function to end trial when it is time\n const end_trial = () => {\n // kill keyboard listeners\n if (typeof keyboardListener !== \"undefined\") {\n this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);\n }\n\n // gather the data to store for the trial\n var trial_data = {\n rt: response.rt,\n stimulus: trial.stimulus,\n response: response.key,\n };\n\n // move on to the next trial\n this.jsPsych.finishTrial(trial_data);\n };\n\n // function to handle responses by the subject\n var after_response = (info) => {\n // after a valid response, the stimulus will have the CSS class 'responded'\n // which can be used to provide visual feedback that a response was recorded\n display_element.querySelector(\"#jspsych-html-keyboard-response-stimulus\").className +=\n \" responded\";\n\n // only record the first response\n if (response.key == null) {\n response = info;\n }\n\n if (trial.response_ends_trial) {\n end_trial();\n }\n };\n\n // start the response listener\n if (trial.choices != \"NO_KEYS\") {\n var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({\n callback_function: after_response,\n valid_responses: trial.choices,\n rt_method: \"performance\",\n persist: false,\n allow_held_key: false,\n });\n }\n\n // hide stimulus if stimulus_duration is set\n if (trial.stimulus_duration !== null) {\n this.jsPsych.pluginAPI.setTimeout(() => {\n display_element.querySelector<HTMLElement>(\n \"#jspsych-html-keyboard-response-stimulus\"\n ).style.visibility = \"hidden\";\n }, trial.stimulus_duration);\n }\n\n // end trial if trial_duration is set\n if (trial.trial_duration !== null) {\n this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);\n }\n }\n\n simulate(\n trial: TrialType<Info>,\n simulation_mode,\n simulation_options: any,\n load_callback: () => void\n ) {\n if (simulation_mode == \"data-only\") {\n load_callback();\n this.simulate_data_only(trial, simulation_options);\n }\n if (simulation_mode == \"visual\") {\n this.simulate_visual(trial, simulation_options, load_callback);\n }\n }\n\n private create_simulation_data(trial: TrialType<Info>, simulation_options) {\n const default_data = {\n stimulus: trial.stimulus,\n rt: this.jsPsych.randomization.sampleExGaussian(500, 50, 1 / 150, true),\n response: this.jsPsych.pluginAPI.getValidKey(trial.choices),\n };\n\n const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);\n\n this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);\n\n return data;\n }\n\n private simulate_data_only(trial: TrialType<Info>, simulation_options) {\n const data = this.create_simulation_data(trial, simulation_options);\n\n this.jsPsych.finishTrial(data);\n }\n\n private simulate_visual(trial: TrialType<Info>, simulation_options, load_callback: () => void) {\n const data = this.create_simulation_data(trial, simulation_options);\n\n const display_element = this.jsPsych.getDisplayElement();\n\n this.trial(display_element, trial);\n load_callback();\n\n if (data.rt !== null) {\n this.jsPsych.pluginAPI.pressKey(data.response, data.rt);\n }\n }\n}\n\nexport default HtmlKeyboardResponsePlugin;\n"],"names":[],"mappings":";;;;AAEE,IAAW,OAAA,GAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECiFA,SAAA,EAAA;AAAA;;GAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,120 +1,175 @@
1
- import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
1
+ import { JsPsychPlugin, ParameterType, JsPsych, TrialType } from 'jspsych';
2
+
2
3
  declare const info: {
3
4
  readonly name: "html-keyboard-response";
5
+ readonly version: string;
4
6
  readonly parameters: {
5
7
  /**
6
- * The HTML string to be displayed.
8
+ * The string to be displayed.
7
9
  */
8
10
  readonly stimulus: {
9
11
  readonly type: ParameterType.HTML_STRING;
10
- readonly pretty_name: "Stimulus";
11
12
  readonly default: any;
12
13
  };
13
14
  /**
14
- * Array containing the key(s) the subject is allowed to press to respond to the stimulus.
15
+ * This array contains the key(s) that the participant is allowed to press in order to respond
16
+ * to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see
17
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values this page}
18
+ * and
19
+ * {@link https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/ this page (event.key column)}
20
+ * for more examples. Any key presses that are not listed in the
21
+ * array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses.
22
+ * Specifying `"NO_KEYS"` will mean that no responses are allowed.
15
23
  */
16
24
  readonly choices: {
17
25
  readonly type: ParameterType.KEYS;
18
- readonly pretty_name: "Choices";
19
26
  readonly default: "ALL_KEYS";
20
27
  };
21
28
  /**
22
- * Any content here will be displayed below the stimulus.
29
+ * This string can contain HTML markup. Any content here will be displayed below the stimulus.
30
+ * The intention is that it can be used to provide a reminder about the action the participant
31
+ * is supposed to take (e.g., which key to press).
23
32
  */
24
33
  readonly prompt: {
25
34
  readonly type: ParameterType.HTML_STRING;
26
- readonly pretty_name: "Prompt";
27
35
  readonly default: any;
28
36
  };
29
37
  /**
30
- * How long to show the stimulus.
38
+ * How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus
39
+ * will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will
40
+ * remain visible until the trial ends.
31
41
  */
32
42
  readonly stimulus_duration: {
33
43
  readonly type: ParameterType.INT;
34
- readonly pretty_name: "Stimulus duration";
35
44
  readonly default: any;
36
45
  };
37
46
  /**
38
- * How long to show trial before it ends.
47
+ * How long to wait for the participant to make a response before ending the trial in milliseconds.
48
+ * If the participant fails to make a response before this timer is reached, the participant's response
49
+ * will be recorded as null for the trial and the trial will end. If the value of this parameter is null,
50
+ * then the trial will wait for a response indefinitely.
39
51
  */
40
52
  readonly trial_duration: {
41
53
  readonly type: ParameterType.INT;
42
- readonly pretty_name: "Trial duration";
43
54
  readonly default: any;
44
55
  };
45
56
  /**
46
- * If true, trial will end when subject makes a response.
57
+ * If true, then the trial will end whenever the participant makes a response (assuming they make their
58
+ * response before the cutoff specified by the trial_duration parameter). If false, then the trial will
59
+ * continue until the value for trial_duration is reached. You can set this parameter to false to force
60
+ * the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete.
47
61
  */
48
62
  readonly response_ends_trial: {
49
63
  readonly type: ParameterType.BOOL;
50
- readonly pretty_name: "Response ends trial";
51
64
  readonly default: true;
52
65
  };
53
66
  };
67
+ readonly data: {
68
+ /** Indicates which key the participant pressed. */
69
+ readonly response: {
70
+ readonly type: ParameterType.STRING;
71
+ };
72
+ /** 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. */
73
+ readonly rt: {
74
+ readonly type: ParameterType.INT;
75
+ };
76
+ /** The HTML content that was displayed on the screen. */
77
+ readonly stimulus: {
78
+ readonly type: ParameterType.STRING;
79
+ };
80
+ };
81
+ readonly citations: "__CITATIONS__";
54
82
  };
55
83
  type Info = typeof info;
56
84
  /**
57
- * **html-keyboard-response**
58
- *
59
- * jsPsych plugin for displaying a stimulus and getting a keyboard response
85
+ * This plugin displays HTML content and records responses generated with the keyboard.
86
+ * The stimulus can be displayed until a response is given, or for a pre-determined amount of time.
87
+ * The trial can be ended automatically if the participant has failed to respond within a fixed length of time.
60
88
  *
61
89
  * @author Josh de Leeuw
62
- * @see {@link https://www.jspsych.org/plugins/jspsych-html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}
90
+ * @see {@link https://www.jspsych.org/latest/plugins/html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}
63
91
  */
64
92
  declare class HtmlKeyboardResponsePlugin implements JsPsychPlugin<Info> {
65
93
  private jsPsych;
66
94
  static info: {
67
95
  readonly name: "html-keyboard-response";
96
+ readonly version: string;
68
97
  readonly parameters: {
69
98
  /**
70
- * The HTML string to be displayed.
99
+ * The string to be displayed.
71
100
  */
72
101
  readonly stimulus: {
73
102
  readonly type: ParameterType.HTML_STRING;
74
- readonly pretty_name: "Stimulus";
75
103
  readonly default: any;
76
104
  };
77
105
  /**
78
- * Array containing the key(s) the subject is allowed to press to respond to the stimulus.
106
+ * This array contains the key(s) that the participant is allowed to press in order to respond
107
+ * to the stimulus. Keys should be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see
108
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values this page}
109
+ * and
110
+ * {@link https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/ this page (event.key column)}
111
+ * for more examples. Any key presses that are not listed in the
112
+ * array will be ignored. The default value of `"ALL_KEYS"` means that all keys will be accepted as valid responses.
113
+ * Specifying `"NO_KEYS"` will mean that no responses are allowed.
79
114
  */
80
115
  readonly choices: {
81
116
  readonly type: ParameterType.KEYS;
82
- readonly pretty_name: "Choices";
83
117
  readonly default: "ALL_KEYS";
84
118
  };
85
119
  /**
86
- * Any content here will be displayed below the stimulus.
120
+ * This string can contain HTML markup. Any content here will be displayed below the stimulus.
121
+ * The intention is that it can be used to provide a reminder about the action the participant
122
+ * is supposed to take (e.g., which key to press).
87
123
  */
88
124
  readonly prompt: {
89
125
  readonly type: ParameterType.HTML_STRING;
90
- readonly pretty_name: "Prompt";
91
126
  readonly default: any;
92
127
  };
93
128
  /**
94
- * How long to show the stimulus.
129
+ * How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus
130
+ * will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will
131
+ * remain visible until the trial ends.
95
132
  */
96
133
  readonly stimulus_duration: {
97
134
  readonly type: ParameterType.INT;
98
- readonly pretty_name: "Stimulus duration";
99
135
  readonly default: any;
100
136
  };
101
137
  /**
102
- * How long to show trial before it ends.
138
+ * How long to wait for the participant to make a response before ending the trial in milliseconds.
139
+ * If the participant fails to make a response before this timer is reached, the participant's response
140
+ * will be recorded as null for the trial and the trial will end. If the value of this parameter is null,
141
+ * then the trial will wait for a response indefinitely.
103
142
  */
104
143
  readonly trial_duration: {
105
144
  readonly type: ParameterType.INT;
106
- readonly pretty_name: "Trial duration";
107
145
  readonly default: any;
108
146
  };
109
147
  /**
110
- * If true, trial will end when subject makes a response.
148
+ * If true, then the trial will end whenever the participant makes a response (assuming they make their
149
+ * response before the cutoff specified by the trial_duration parameter). If false, then the trial will
150
+ * continue until the value for trial_duration is reached. You can set this parameter to false to force
151
+ * the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete.
111
152
  */
112
153
  readonly response_ends_trial: {
113
154
  readonly type: ParameterType.BOOL;
114
- readonly pretty_name: "Response ends trial";
115
155
  readonly default: true;
116
156
  };
117
157
  };
158
+ readonly data: {
159
+ /** Indicates which key the participant pressed. */
160
+ readonly response: {
161
+ readonly type: ParameterType.STRING;
162
+ };
163
+ /** 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. */
164
+ readonly rt: {
165
+ readonly type: ParameterType.INT;
166
+ };
167
+ /** The HTML content that was displayed on the screen. */
168
+ readonly stimulus: {
169
+ readonly type: ParameterType.STRING;
170
+ };
171
+ };
172
+ readonly citations: "__CITATIONS__";
118
173
  };
119
174
  constructor(jsPsych: JsPsych);
120
175
  trial(display_element: HTMLElement, trial: TrialType<Info>): void;
@@ -123,4 +178,5 @@ declare class HtmlKeyboardResponsePlugin implements JsPsychPlugin<Info> {
123
178
  private simulate_data_only;
124
179
  private simulate_visual;
125
180
  }
126
- export default HtmlKeyboardResponsePlugin;
181
+
182
+ export { HtmlKeyboardResponsePlugin as default };