@jspsych/plugin-html-keyboard-response 1.1.3 → 2.0.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.browser.js +163 -156
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +2 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +161 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +84 -30
- package/dist/index.js +161 -154
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.spec.ts +7 -6
- package/src/index.ts +44 -23
package/dist/index.browser.js
CHANGED
|
@@ -1,174 +1,181 @@
|
|
|
1
1
|
var jsPsychHtmlKeyboardResponse = (function (jspsych) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var _package = {
|
|
5
|
+
name: "@jspsych/plugin-html-keyboard-response",
|
|
6
|
+
version: "2.0.0",
|
|
7
|
+
description: "jsPsych plugin for displaying a stimulus and getting a keyboard response",
|
|
8
|
+
type: "module",
|
|
9
|
+
main: "dist/index.cjs",
|
|
10
|
+
exports: {
|
|
11
|
+
import: "./dist/index.js",
|
|
12
|
+
require: "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
typings: "dist/index.d.ts",
|
|
15
|
+
unpkg: "dist/index.browser.min.js",
|
|
16
|
+
files: [
|
|
17
|
+
"src",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
source: "src/index.ts",
|
|
21
|
+
scripts: {
|
|
22
|
+
test: "jest",
|
|
23
|
+
"test:watch": "npm test -- --watch",
|
|
24
|
+
tsc: "tsc",
|
|
25
|
+
build: "rollup --config",
|
|
26
|
+
"build:watch": "npm run build -- --watch"
|
|
27
|
+
},
|
|
28
|
+
repository: {
|
|
29
|
+
type: "git",
|
|
30
|
+
url: "git+https://github.com/jspsych/jsPsych.git",
|
|
31
|
+
directory: "packages/plugin-html-keyboard-response"
|
|
32
|
+
},
|
|
33
|
+
author: "Josh de Leeuw",
|
|
34
|
+
license: "MIT",
|
|
35
|
+
bugs: {
|
|
36
|
+
url: "https://github.com/jspsych/jsPsych/issues"
|
|
37
|
+
},
|
|
38
|
+
homepage: "https://www.jspsych.org/latest/plugins/html-keyboard-response",
|
|
39
|
+
peerDependencies: {
|
|
40
|
+
jspsych: ">=7.1.0"
|
|
41
|
+
},
|
|
42
|
+
devDependencies: {
|
|
43
|
+
"@jspsych/config": "^3.0.0",
|
|
44
|
+
"@jspsych/test-utils": "^1.2.0"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
4
48
|
const info = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type: jspsych.ParameterType.HTML_STRING,
|
|
28
|
-
pretty_name: "Prompt",
|
|
29
|
-
default: null,
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* How long to show the stimulus.
|
|
33
|
-
*/
|
|
34
|
-
stimulus_duration: {
|
|
35
|
-
type: jspsych.ParameterType.INT,
|
|
36
|
-
pretty_name: "Stimulus duration",
|
|
37
|
-
default: null,
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* How long to show trial before it ends.
|
|
41
|
-
*/
|
|
42
|
-
trial_duration: {
|
|
43
|
-
type: jspsych.ParameterType.INT,
|
|
44
|
-
pretty_name: "Trial duration",
|
|
45
|
-
default: null,
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* If true, trial will end when subject makes a response.
|
|
49
|
-
*/
|
|
50
|
-
response_ends_trial: {
|
|
51
|
-
type: jspsych.ParameterType.BOOL,
|
|
52
|
-
pretty_name: "Response ends trial",
|
|
53
|
-
default: true,
|
|
54
|
-
},
|
|
49
|
+
name: "html-keyboard-response",
|
|
50
|
+
version: _package.version,
|
|
51
|
+
parameters: {
|
|
52
|
+
stimulus: {
|
|
53
|
+
type: jspsych.ParameterType.HTML_STRING,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
choices: {
|
|
57
|
+
type: jspsych.ParameterType.KEYS,
|
|
58
|
+
default: "ALL_KEYS"
|
|
59
|
+
},
|
|
60
|
+
prompt: {
|
|
61
|
+
type: jspsych.ParameterType.HTML_STRING,
|
|
62
|
+
default: null
|
|
63
|
+
},
|
|
64
|
+
stimulus_duration: {
|
|
65
|
+
type: jspsych.ParameterType.INT,
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
trial_duration: {
|
|
69
|
+
type: jspsych.ParameterType.INT,
|
|
70
|
+
default: null
|
|
55
71
|
},
|
|
72
|
+
response_ends_trial: {
|
|
73
|
+
type: jspsych.ParameterType.BOOL,
|
|
74
|
+
default: true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
data: {
|
|
78
|
+
response: {
|
|
79
|
+
type: jspsych.ParameterType.STRING
|
|
80
|
+
},
|
|
81
|
+
rt: {
|
|
82
|
+
type: jspsych.ParameterType.INT
|
|
83
|
+
},
|
|
84
|
+
stimulus: {
|
|
85
|
+
type: jspsych.ParameterType.STRING
|
|
86
|
+
}
|
|
87
|
+
}
|
|
56
88
|
};
|
|
57
|
-
/**
|
|
58
|
-
* **html-keyboard-response**
|
|
59
|
-
*
|
|
60
|
-
* jsPsych plugin for displaying a stimulus and getting a keyboard response
|
|
61
|
-
*
|
|
62
|
-
* @author Josh de Leeuw
|
|
63
|
-
* @see {@link https://www.jspsych.org/plugins/jspsych-html-keyboard-response/ html-keyboard-response plugin documentation on jspsych.org}
|
|
64
|
-
*/
|
|
65
89
|
class HtmlKeyboardResponsePlugin {
|
|
66
|
-
|
|
67
|
-
|
|
90
|
+
constructor(jsPsych) {
|
|
91
|
+
this.jsPsych = jsPsych;
|
|
92
|
+
}
|
|
93
|
+
static info = info;
|
|
94
|
+
trial(display_element, trial) {
|
|
95
|
+
var new_html = '<div id="jspsych-html-keyboard-response-stimulus">' + trial.stimulus + "</div>";
|
|
96
|
+
if (trial.prompt !== null) {
|
|
97
|
+
new_html += trial.prompt;
|
|
98
|
+
}
|
|
99
|
+
display_element.innerHTML = new_html;
|
|
100
|
+
var response = {
|
|
101
|
+
rt: null,
|
|
102
|
+
key: null
|
|
103
|
+
};
|
|
104
|
+
const end_trial = () => {
|
|
105
|
+
if (typeof keyboardListener !== "undefined") {
|
|
106
|
+
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
|
107
|
+
}
|
|
108
|
+
var trial_data = {
|
|
109
|
+
rt: response.rt,
|
|
110
|
+
stimulus: trial.stimulus,
|
|
111
|
+
response: response.key
|
|
112
|
+
};
|
|
113
|
+
this.jsPsych.finishTrial(trial_data);
|
|
114
|
+
};
|
|
115
|
+
var after_response = (info2) => {
|
|
116
|
+
display_element.querySelector("#jspsych-html-keyboard-response-stimulus").className += " responded";
|
|
117
|
+
if (response.key == null) {
|
|
118
|
+
response = info2;
|
|
119
|
+
}
|
|
120
|
+
if (trial.response_ends_trial) {
|
|
121
|
+
end_trial();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
if (trial.choices != "NO_KEYS") {
|
|
125
|
+
var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({
|
|
126
|
+
callback_function: after_response,
|
|
127
|
+
valid_responses: trial.choices,
|
|
128
|
+
rt_method: "performance",
|
|
129
|
+
persist: false,
|
|
130
|
+
allow_held_key: false
|
|
131
|
+
});
|
|
68
132
|
}
|
|
69
|
-
trial
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// draw
|
|
76
|
-
display_element.innerHTML = new_html;
|
|
77
|
-
// store response
|
|
78
|
-
var response = {
|
|
79
|
-
rt: null,
|
|
80
|
-
key: null,
|
|
81
|
-
};
|
|
82
|
-
// function to end trial when it is time
|
|
83
|
-
const end_trial = () => {
|
|
84
|
-
// kill any remaining setTimeout handlers
|
|
85
|
-
this.jsPsych.pluginAPI.clearAllTimeouts();
|
|
86
|
-
// kill keyboard listeners
|
|
87
|
-
if (typeof keyboardListener !== "undefined") {
|
|
88
|
-
this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener);
|
|
89
|
-
}
|
|
90
|
-
// gather the data to store for the trial
|
|
91
|
-
var trial_data = {
|
|
92
|
-
rt: response.rt,
|
|
93
|
-
stimulus: trial.stimulus,
|
|
94
|
-
response: response.key,
|
|
95
|
-
};
|
|
96
|
-
// clear the display
|
|
97
|
-
display_element.innerHTML = "";
|
|
98
|
-
// move on to the next trial
|
|
99
|
-
this.jsPsych.finishTrial(trial_data);
|
|
100
|
-
};
|
|
101
|
-
// function to handle responses by the subject
|
|
102
|
-
var after_response = (info) => {
|
|
103
|
-
// after a valid response, the stimulus will have the CSS class 'responded'
|
|
104
|
-
// which can be used to provide visual feedback that a response was recorded
|
|
105
|
-
display_element.querySelector("#jspsych-html-keyboard-response-stimulus").className +=
|
|
106
|
-
" responded";
|
|
107
|
-
// only record the first response
|
|
108
|
-
if (response.key == null) {
|
|
109
|
-
response = info;
|
|
110
|
-
}
|
|
111
|
-
if (trial.response_ends_trial) {
|
|
112
|
-
end_trial();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
// start the response listener
|
|
116
|
-
if (trial.choices != "NO_KEYS") {
|
|
117
|
-
var keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({
|
|
118
|
-
callback_function: after_response,
|
|
119
|
-
valid_responses: trial.choices,
|
|
120
|
-
rt_method: "performance",
|
|
121
|
-
persist: false,
|
|
122
|
-
allow_held_key: false,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
// hide stimulus if stimulus_duration is set
|
|
126
|
-
if (trial.stimulus_duration !== null) {
|
|
127
|
-
this.jsPsych.pluginAPI.setTimeout(() => {
|
|
128
|
-
display_element.querySelector("#jspsych-html-keyboard-response-stimulus").style.visibility = "hidden";
|
|
129
|
-
}, trial.stimulus_duration);
|
|
130
|
-
}
|
|
131
|
-
// end trial if trial_duration is set
|
|
132
|
-
if (trial.trial_duration !== null) {
|
|
133
|
-
this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);
|
|
134
|
-
}
|
|
133
|
+
if (trial.stimulus_duration !== null) {
|
|
134
|
+
this.jsPsych.pluginAPI.setTimeout(() => {
|
|
135
|
+
display_element.querySelector(
|
|
136
|
+
"#jspsych-html-keyboard-response-stimulus"
|
|
137
|
+
).style.visibility = "hidden";
|
|
138
|
+
}, trial.stimulus_duration);
|
|
135
139
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
load_callback();
|
|
139
|
-
this.simulate_data_only(trial, simulation_options);
|
|
140
|
-
}
|
|
141
|
-
if (simulation_mode == "visual") {
|
|
142
|
-
this.simulate_visual(trial, simulation_options, load_callback);
|
|
143
|
-
}
|
|
140
|
+
if (trial.trial_duration !== null) {
|
|
141
|
+
this.jsPsych.pluginAPI.setTimeout(end_trial, trial.trial_duration);
|
|
144
142
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
};
|
|
151
|
-
const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);
|
|
152
|
-
this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);
|
|
153
|
-
return data;
|
|
143
|
+
}
|
|
144
|
+
simulate(trial, simulation_mode, simulation_options, load_callback) {
|
|
145
|
+
if (simulation_mode == "data-only") {
|
|
146
|
+
load_callback();
|
|
147
|
+
this.simulate_data_only(trial, simulation_options);
|
|
154
148
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
this.jsPsych.finishTrial(data);
|
|
149
|
+
if (simulation_mode == "visual") {
|
|
150
|
+
this.simulate_visual(trial, simulation_options, load_callback);
|
|
158
151
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
152
|
+
}
|
|
153
|
+
create_simulation_data(trial, simulation_options) {
|
|
154
|
+
const default_data = {
|
|
155
|
+
stimulus: trial.stimulus,
|
|
156
|
+
rt: this.jsPsych.randomization.sampleExGaussian(500, 50, 1 / 150, true),
|
|
157
|
+
response: this.jsPsych.pluginAPI.getValidKey(trial.choices)
|
|
158
|
+
};
|
|
159
|
+
const data = this.jsPsych.pluginAPI.mergeSimulationData(default_data, simulation_options);
|
|
160
|
+
this.jsPsych.pluginAPI.ensureSimulationDataConsistency(trial, data);
|
|
161
|
+
return data;
|
|
162
|
+
}
|
|
163
|
+
simulate_data_only(trial, simulation_options) {
|
|
164
|
+
const data = this.create_simulation_data(trial, simulation_options);
|
|
165
|
+
this.jsPsych.finishTrial(data);
|
|
166
|
+
}
|
|
167
|
+
simulate_visual(trial, simulation_options, load_callback) {
|
|
168
|
+
const data = this.create_simulation_data(trial, simulation_options);
|
|
169
|
+
const display_element = this.jsPsych.getDisplayElement();
|
|
170
|
+
this.trial(display_element, trial);
|
|
171
|
+
load_callback();
|
|
172
|
+
if (data.rt !== null) {
|
|
173
|
+
this.jsPsych.pluginAPI.pressKey(data.response, data.rt);
|
|
167
174
|
}
|
|
175
|
+
}
|
|
168
176
|
}
|
|
169
|
-
HtmlKeyboardResponsePlugin.info = info;
|
|
170
177
|
|
|
171
178
|
return HtmlKeyboardResponsePlugin;
|
|
172
179
|
|
|
173
180
|
})(jsPsychModule);
|
|
174
|
-
//# sourceMappingURL=https://unpkg.com/@jspsych/plugin-html-keyboard-response@
|
|
181
|
+
//# sourceMappingURL=https://unpkg.com/@jspsych/plugin-html-keyboard-response@2.0.0/dist/index.browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","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":";;;EAEA,MAAM,IAAI,GAAU;EAClB,IAAA,IAAI,EAAE,wBAAwB;EAC9B,IAAA,UAAU,EAAE;EACV;;EAEG;EACH,QAAA,QAAQ,EAAE;cACR,IAAI,EAAEA,qBAAa,CAAC,WAAW;EAC/B,YAAA,WAAW,EAAE,UAAU;EACvB,YAAA,OAAO,EAAE,SAAS;EACnB,SAAA;EACD;;EAEG;EACH,QAAA,OAAO,EAAE;cACP,IAAI,EAAEA,qBAAa,CAAC,IAAI;EACxB,YAAA,WAAW,EAAE,SAAS;EACtB,YAAA,OAAO,EAAE,UAAU;EACpB,SAAA;EACD;;EAEG;EACH,QAAA,MAAM,EAAE;cACN,IAAI,EAAEA,qBAAa,CAAC,WAAW;EAC/B,YAAA,WAAW,EAAE,QAAQ;EACrB,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACD;;EAEG;EACH,QAAA,iBAAiB,EAAE;cACjB,IAAI,EAAEA,qBAAa,CAAC,GAAG;EACvB,YAAA,WAAW,EAAE,mBAAmB;EAChC,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACD;;EAEG;EACH,QAAA,cAAc,EAAE;cACd,IAAI,EAAEA,qBAAa,CAAC,GAAG;EACvB,YAAA,WAAW,EAAE,gBAAgB;EAC7B,YAAA,OAAO,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,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;EAEzD,QAAA,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;EACnC,QAAA,aAAa,EAAE,CAAC;EAEhB,QAAA,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;EACpB,YAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;EACzD,SAAA;OACF;;EAtIM,0BAAI,CAAA,IAAA,GAAG,IAAI;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.browser.js","sources":["../src/index.ts"],"sourcesContent":["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};\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":["version","ParameterType","info"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA,MAAM,IAAc,GAAA;EAAA,EAClB,IAAM,EAAA,wBAAA;EAAA,WACNA,gBAAA;EAAA,EACA,UAAY,EAAA;EAAA,IAIV,QAAU,EAAA;EAAA,MACR,MAAMC,qBAAc,CAAA,WAAA;EAAA,MACpB,OAAS,EAAA,KAAA,CAAA;EAAA,KACX;EAAA,IAWA,OAAS,EAAA;EAAA,MACP,MAAMA,qBAAc,CAAA,IAAA;EAAA,MACpB,OAAS,EAAA,UAAA;EAAA,KACX;EAAA,IAMA,MAAQ,EAAA;EAAA,MACN,MAAMA,qBAAc,CAAA,WAAA;EAAA,MACpB,OAAS,EAAA,IAAA;EAAA,KACX;EAAA,IAMA,iBAAmB,EAAA;EAAA,MACjB,MAAMA,qBAAc,CAAA,GAAA;EAAA,MACpB,OAAS,EAAA,IAAA;EAAA,KACX;EAAA,IAOA,cAAgB,EAAA;EAAA,MACd,MAAMA,qBAAc,CAAA,GAAA;EAAA,MACpB,OAAS,EAAA,IAAA;EAAA,KACX;EAAA,IAOA,mBAAqB,EAAA;EAAA,MACnB,MAAMA,qBAAc,CAAA,IAAA;EAAA,MACpB,OAAS,EAAA,IAAA;EAAA,KACX;EAAA,GACF;EAAA,EACA,IAAM,EAAA;EAAA,IAEJ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,IAAK,IAAA,CAAA,KAAA,CAAM,iBAAiB,KAAK,CAAA,CAAA;EACjC,IAAc,aAAA,EAAA,CAAA;EAEd,IAAI,IAAA,IAAA,CAAK,OAAO,IAAM,EAAA;EACpB,MAAA,IAAA,CAAK,QAAQ,SAAU,CAAA,QAAA,CAAS,IAAK,CAAA,QAAA,EAAU,KAAK,EAAE,CAAA,CAAA;EAAA,KACxD;EAAA,GACF;EACF;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var jsPsychHtmlKeyboardResponse=function(
|
|
2
|
-
//# sourceMappingURL=https://unpkg.com/@jspsych/plugin-html-keyboard-response@
|
|
1
|
+
var jsPsychHtmlKeyboardResponse=function(a){"use strict";var o={name:"@jspsych/plugin-html-keyboard-response",version:"2.0.0",description:"jsPsych plugin for displaying a stimulus and getting a keyboard response",type:"module",main:"dist/index.cjs",exports:{import:"./dist/index.js",require:"./dist/index.cjs"},typings:"dist/index.d.ts",unpkg:"dist/index.browser.min.js",files:["src","dist"],source:"src/index.ts",scripts:{test:"jest","test:watch":"npm test -- --watch",tsc:"tsc",build:"rollup --config","build:watch":"npm run build -- --watch"},repository:{type:"git",url:"git+https://github.com/jspsych/jsPsych.git",directory:"packages/plugin-html-keyboard-response"},author:"Josh de Leeuw",license:"MIT",bugs:{url:"https://github.com/jspsych/jsPsych/issues"},homepage:"https://www.jspsych.org/latest/plugins/html-keyboard-response",peerDependencies:{jspsych:">=7.1.0"},devDependencies:{"@jspsych/config":"^3.0.0","@jspsych/test-utils":"^1.2.0"}};const p={name:"html-keyboard-response",version:o.version,parameters:{stimulus:{type:a.ParameterType.HTML_STRING,default:void 0},choices:{type:a.ParameterType.KEYS,default:"ALL_KEYS"},prompt:{type:a.ParameterType.HTML_STRING,default:null},stimulus_duration:{type:a.ParameterType.INT,default:null},trial_duration:{type:a.ParameterType.INT,default:null},response_ends_trial:{type:a.ParameterType.BOOL,default:!0}},data:{response:{type:a.ParameterType.STRING},rt:{type:a.ParameterType.INT},stimulus:{type:a.ParameterType.STRING}}};class n{constructor(e){this.jsPsych=e}trial(e,s){var i='<div id="jspsych-html-keyboard-response-stimulus">'+s.stimulus+"</div>";s.prompt!==null&&(i+=s.prompt),e.innerHTML=i;var t={rt:null,key:null};const r=()=>{typeof u!="undefined"&&this.jsPsych.pluginAPI.cancelKeyboardResponse(u);var l={rt:t.rt,stimulus:s.stimulus,response:t.key};this.jsPsych.finishTrial(l)};var c=l=>{e.querySelector("#jspsych-html-keyboard-response-stimulus").className+=" responded",t.key==null&&(t=l),s.response_ends_trial&&r()};if(s.choices!="NO_KEYS")var u=this.jsPsych.pluginAPI.getKeyboardResponse({callback_function:c,valid_responses:s.choices,rt_method:"performance",persist:!1,allow_held_key:!1});s.stimulus_duration!==null&&this.jsPsych.pluginAPI.setTimeout(()=>{e.querySelector("#jspsych-html-keyboard-response-stimulus").style.visibility="hidden"},s.stimulus_duration),s.trial_duration!==null&&this.jsPsych.pluginAPI.setTimeout(r,s.trial_duration)}simulate(e,s,i,t){s=="data-only"&&(t(),this.simulate_data_only(e,i)),s=="visual"&&this.simulate_visual(e,i,t)}create_simulation_data(e,s){const i={stimulus:e.stimulus,rt:this.jsPsych.randomization.sampleExGaussian(500,50,.006666666666666667,!0),response:this.jsPsych.pluginAPI.getValidKey(e.choices)},t=this.jsPsych.pluginAPI.mergeSimulationData(i,s);return this.jsPsych.pluginAPI.ensureSimulationDataConsistency(e,t),t}simulate_data_only(e,s){const i=this.create_simulation_data(e,s);this.jsPsych.finishTrial(i)}simulate_visual(e,s,i){const t=this.create_simulation_data(e,s),r=this.jsPsych.getDisplayElement();this.trial(r,e),i(),t.rt!==null&&this.jsPsych.pluginAPI.pressKey(t.response,t.rt)}}return n.info=p,n}(jsPsychModule);
|
|
2
|
+
//# sourceMappingURL=https://unpkg.com/@jspsych/plugin-html-keyboard-response@2.0.0/dist/index.browser.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.min.js","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":["info","name","parameters","stimulus","type","ParameterType","HTML_STRING","pretty_name","default","undefined","choices","KEYS","prompt","stimulus_duration","INT","trial_duration","response_ends_trial","BOOL","HtmlKeyboardResponsePlugin","jsPsych","_classCallCheck","this","key","value","display_element","trial","_this","new_html","innerHTML","response","rt","end_trial","pluginAPI","clearAllTimeouts","keyboardListener","cancelKeyboardResponse","trial_data","finishTrial","getKeyboardResponse","callback_function","querySelector","className","valid_responses","rt_method","persist","allow_held_key","setTimeout","style","visibility","simulation_mode","simulation_options","load_callback","simulate_data_only","simulate_visual","default_data","randomization","sampleExGaussian","getValidKey","data","mergeSimulationData","ensureSimulationDataConsistency","create_simulation_data","getDisplayElement","pressKey"],"mappings":"wiBAEA,IAAMA,EAAc,CAClBC,KAAM,yBACNC,WAAY,CAIVC,SAAU,CACRC,KAAMC,EAAaA,cAACC,YACpBC,YAAa,WACbC,aAASC,GAKXC,QAAS,CACPN,KAAMC,EAAaA,cAACM,KACpBJ,YAAa,UACbC,QAAS,YAKXI,OAAQ,CACNR,KAAMC,EAAaA,cAACC,YACpBC,YAAa,SACbC,QAAS,MAKXK,kBAAmB,CACjBT,KAAMC,EAAaA,cAACS,IACpBP,YAAa,oBACbC,QAAS,MAKXO,eAAgB,CACdX,KAAMC,EAAaA,cAACS,IACpBP,YAAa,iBACbC,QAAS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V,UAAnBD,GACF5B,KAAKgC,gBAAgB5B,EAAOyB,EAAoBC,EAEpD,GAAC,CAAA7B,IAAA,yBAAAC,MAEO,SAAuBE,EAAwByB,GACrD,IAAMI,EAAe,CACnBnD,SAAUsB,EAAMtB,SAChB2B,GAAIT,KAAKF,QAAQoC,cAAcC,iBAAiB,IAAK,GAAI,EAAI,KAAK,GAClE3B,SAAUR,KAAKF,QAAQa,UAAUyB,YAAYhC,EAAMf,UAG/CgD,EAAOrC,KAAKF,QAAQa,UAAU2B,oBAAoBL,EAAcJ,GAItE,OAFA7B,KAAKF,QAAQa,UAAU4B,gCAAgCnC,EAAOiC,GAEvDA,CACT,GAAC,CAAApC,IAAA,qBAAAC,MAEO,SAAmBE,EAAwByB,GACjD,IAAMQ,EAAOrC,KAAKwC,uBAAuBpC,EAAOyB,GAEhD7B,KAAKF,QAAQkB,YAAYqB,EAC3B,GAAC,CAAApC,IAAA,kBAAAC,MAEO,SAAgBE,EAAwByB,EAAoBC,GAClE,IAAMO,EAAOrC,KAAKwC,uBAAuBpC,EAAOyB,GAE1C1B,EAAkBH,KAAKF,QAAQ2C,oBAErCzC,KAAKI,MAAMD,EAAiBC,GAC5B0B,IAEgB,OAAZO,EAAK5B,IACPT,KAAKF,QAAQa,UAAU+B,SAASL,EAAK7B,SAAU6B,EAAK5B,GAExD,qFAACZ,CAAA,CAvI6B,UACvBA,EAAIlB,KAAGA"}
|
|
1
|
+
{"version":3,"file":"index.browser.min.js","sources":["../src/index.ts"],"sourcesContent":["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};\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":["info","version","ParameterType","HtmlKeyboardResponsePlugin","jsPsych","display_element","trial","new_html","response","end_trial","keyboardListener","trial_data","after_response","simulation_mode","simulation_options","load_callback","default_data","data"],"mappings":"q7BAIA,MAAMA,EAAc,CAClB,KAAM,yBACN,QAASC,UACT,WAAY,CAIV,SAAU,CACR,KAAMC,EAAAA,cAAc,YACpB,QAAS,MACX,EAWA,QAAS,CACP,KAAMA,EAAAA,cAAc,KACpB,QAAS,UACX,EAMA,OAAQ,CACN,KAAMA,EAAc,cAAA,YACpB,QAAS,IACX,EAMA,kBAAmB,CACjB,KAAMA,gBAAc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