@jspsych/plugin-audio-button-response 1.1.1 → 1.1.3
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/README.md +47 -0
- package/dist/index.browser.js +297 -297
- package/dist/index.browser.min.js +2 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +296 -296
- package/dist/index.d.ts +161 -161
- package/dist/index.js +296 -296
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
|
2
|
-
declare const info: {
|
|
3
|
-
readonly name: "audio-button-response";
|
|
4
|
-
readonly parameters: {
|
|
5
|
-
/** The audio to be played. */
|
|
6
|
-
readonly stimulus: {
|
|
7
|
-
readonly type: ParameterType.AUDIO;
|
|
8
|
-
readonly pretty_name: "Stimulus";
|
|
9
|
-
readonly default: any;
|
|
10
|
-
};
|
|
11
|
-
/** Array containing the label(s) for the button(s). */
|
|
12
|
-
readonly choices: {
|
|
13
|
-
readonly type: ParameterType.STRING;
|
|
14
|
-
readonly pretty_name: "Choices";
|
|
15
|
-
readonly default: any;
|
|
16
|
-
readonly array: true;
|
|
17
|
-
};
|
|
18
|
-
/** The HTML for creating button. Can create own style. Use the "%choice%" string to indicate where the label from the choices parameter should be inserted. */
|
|
19
|
-
readonly button_html: {
|
|
20
|
-
readonly type: ParameterType.HTML_STRING;
|
|
21
|
-
readonly pretty_name: "Button HTML";
|
|
22
|
-
readonly default: "<button class=\"jspsych-btn\">%choice%</button>";
|
|
23
|
-
readonly array: true;
|
|
24
|
-
};
|
|
25
|
-
/** Any content here will be displayed below the stimulus. */
|
|
26
|
-
readonly prompt: {
|
|
27
|
-
readonly type: ParameterType.HTML_STRING;
|
|
28
|
-
readonly pretty_name: "Prompt";
|
|
29
|
-
readonly default: any;
|
|
30
|
-
};
|
|
31
|
-
/** The maximum duration to wait for a response. */
|
|
32
|
-
readonly trial_duration: {
|
|
33
|
-
readonly type: ParameterType.INT;
|
|
34
|
-
readonly pretty_name: "Trial duration";
|
|
35
|
-
readonly default: any;
|
|
36
|
-
};
|
|
37
|
-
/** Vertical margin of button. */
|
|
38
|
-
readonly margin_vertical: {
|
|
39
|
-
readonly type: ParameterType.STRING;
|
|
40
|
-
readonly pretty_name: "Margin vertical";
|
|
41
|
-
readonly default: "0px";
|
|
42
|
-
};
|
|
43
|
-
/** Horizontal margin of button. */
|
|
44
|
-
readonly margin_horizontal: {
|
|
45
|
-
readonly type: ParameterType.STRING;
|
|
46
|
-
readonly pretty_name: "Margin horizontal";
|
|
47
|
-
readonly default: "8px";
|
|
48
|
-
};
|
|
49
|
-
/** If true, the trial will end when user makes a response. */
|
|
50
|
-
readonly response_ends_trial: {
|
|
51
|
-
readonly type: ParameterType.BOOL;
|
|
52
|
-
readonly pretty_name: "Response ends trial";
|
|
53
|
-
readonly default: true;
|
|
54
|
-
};
|
|
55
|
-
/** If true, then the trial will end as soon as the audio file finishes playing. */
|
|
56
|
-
readonly trial_ends_after_audio: {
|
|
57
|
-
readonly type: ParameterType.BOOL;
|
|
58
|
-
readonly pretty_name: "Trial ends after audio";
|
|
59
|
-
readonly default: false;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* If true, then responses are allowed while the audio is playing.
|
|
63
|
-
* If false, then the audio must finish playing before a response is accepted.
|
|
64
|
-
*/
|
|
65
|
-
readonly response_allowed_while_playing: {
|
|
66
|
-
readonly type: ParameterType.BOOL;
|
|
67
|
-
readonly pretty_name: "Response allowed while playing";
|
|
68
|
-
readonly default: true;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* **audio-button-response**
|
|
75
|
-
*
|
|
76
|
-
* jsPsych plugin for playing an audio file and getting a button response
|
|
77
|
-
*
|
|
78
|
-
* @author Kristin Diep
|
|
79
|
-
* @see {@link https://www.jspsych.org/plugins/jspsych-audio-button-response/ audio-button-response plugin documentation on jspsych.org}
|
|
80
|
-
*/
|
|
81
|
-
declare class AudioButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|
82
|
-
private jsPsych;
|
|
83
|
-
static info: {
|
|
84
|
-
readonly name: "audio-button-response";
|
|
85
|
-
readonly parameters: {
|
|
86
|
-
/** The audio to be played. */
|
|
87
|
-
readonly stimulus: {
|
|
88
|
-
readonly type: ParameterType.AUDIO;
|
|
89
|
-
readonly pretty_name: "Stimulus";
|
|
90
|
-
readonly default: any;
|
|
91
|
-
};
|
|
92
|
-
/** Array containing the label(s) for the button(s). */
|
|
93
|
-
readonly choices: {
|
|
94
|
-
readonly type: ParameterType.STRING;
|
|
95
|
-
readonly pretty_name: "Choices";
|
|
96
|
-
readonly default: any;
|
|
97
|
-
readonly array: true;
|
|
98
|
-
};
|
|
99
|
-
/** The HTML for creating button. Can create own style. Use the "%choice%" string to indicate where the label from the choices parameter should be inserted. */
|
|
100
|
-
readonly button_html: {
|
|
101
|
-
readonly type: ParameterType.HTML_STRING;
|
|
102
|
-
readonly pretty_name: "Button HTML";
|
|
103
|
-
readonly default: "<button class=\"jspsych-btn\">%choice%</button>";
|
|
104
|
-
readonly array: true;
|
|
105
|
-
};
|
|
106
|
-
/** Any content here will be displayed below the stimulus. */
|
|
107
|
-
readonly prompt: {
|
|
108
|
-
readonly type: ParameterType.HTML_STRING;
|
|
109
|
-
readonly pretty_name: "Prompt";
|
|
110
|
-
readonly default: any;
|
|
111
|
-
};
|
|
112
|
-
/** The maximum duration to wait for a response. */
|
|
113
|
-
readonly trial_duration: {
|
|
114
|
-
readonly type: ParameterType.INT;
|
|
115
|
-
readonly pretty_name: "Trial duration";
|
|
116
|
-
readonly default: any;
|
|
117
|
-
};
|
|
118
|
-
/** Vertical margin of button. */
|
|
119
|
-
readonly margin_vertical: {
|
|
120
|
-
readonly type: ParameterType.STRING;
|
|
121
|
-
readonly pretty_name: "Margin vertical";
|
|
122
|
-
readonly default: "0px";
|
|
123
|
-
};
|
|
124
|
-
/** Horizontal margin of button. */
|
|
125
|
-
readonly margin_horizontal: {
|
|
126
|
-
readonly type: ParameterType.STRING;
|
|
127
|
-
readonly pretty_name: "Margin horizontal";
|
|
128
|
-
readonly default: "8px";
|
|
129
|
-
};
|
|
130
|
-
/** If true, the trial will end when user makes a response. */
|
|
131
|
-
readonly response_ends_trial: {
|
|
132
|
-
readonly type: ParameterType.BOOL;
|
|
133
|
-
readonly pretty_name: "Response ends trial";
|
|
134
|
-
readonly default: true;
|
|
135
|
-
};
|
|
136
|
-
/** If true, then the trial will end as soon as the audio file finishes playing. */
|
|
137
|
-
readonly trial_ends_after_audio: {
|
|
138
|
-
readonly type: ParameterType.BOOL;
|
|
139
|
-
readonly pretty_name: "Trial ends after audio";
|
|
140
|
-
readonly default: false;
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* If true, then responses are allowed while the audio is playing.
|
|
144
|
-
* If false, then the audio must finish playing before a response is accepted.
|
|
145
|
-
*/
|
|
146
|
-
readonly response_allowed_while_playing: {
|
|
147
|
-
readonly type: ParameterType.BOOL;
|
|
148
|
-
readonly pretty_name: "Response allowed while playing";
|
|
149
|
-
readonly default: true;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
private audio;
|
|
154
|
-
constructor(jsPsych: JsPsych);
|
|
155
|
-
trial(display_element: HTMLElement, trial: TrialType<Info>, on_load: () => void): Promise<unknown>;
|
|
156
|
-
simulate(trial: TrialType<Info>, simulation_mode: any, simulation_options: any, load_callback: () => void): void;
|
|
157
|
-
private create_simulation_data;
|
|
158
|
-
private simulate_data_only;
|
|
159
|
-
private simulate_visual;
|
|
160
|
-
}
|
|
161
|
-
export default AudioButtonResponsePlugin;
|
|
1
|
+
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
|
2
|
+
declare const info: {
|
|
3
|
+
readonly name: "audio-button-response";
|
|
4
|
+
readonly parameters: {
|
|
5
|
+
/** The audio to be played. */
|
|
6
|
+
readonly stimulus: {
|
|
7
|
+
readonly type: ParameterType.AUDIO;
|
|
8
|
+
readonly pretty_name: "Stimulus";
|
|
9
|
+
readonly default: any;
|
|
10
|
+
};
|
|
11
|
+
/** Array containing the label(s) for the button(s). */
|
|
12
|
+
readonly choices: {
|
|
13
|
+
readonly type: ParameterType.STRING;
|
|
14
|
+
readonly pretty_name: "Choices";
|
|
15
|
+
readonly default: any;
|
|
16
|
+
readonly array: true;
|
|
17
|
+
};
|
|
18
|
+
/** The HTML for creating button. Can create own style. Use the "%choice%" string to indicate where the label from the choices parameter should be inserted. */
|
|
19
|
+
readonly button_html: {
|
|
20
|
+
readonly type: ParameterType.HTML_STRING;
|
|
21
|
+
readonly pretty_name: "Button HTML";
|
|
22
|
+
readonly default: "<button class=\"jspsych-btn\">%choice%</button>";
|
|
23
|
+
readonly array: true;
|
|
24
|
+
};
|
|
25
|
+
/** Any content here will be displayed below the stimulus. */
|
|
26
|
+
readonly prompt: {
|
|
27
|
+
readonly type: ParameterType.HTML_STRING;
|
|
28
|
+
readonly pretty_name: "Prompt";
|
|
29
|
+
readonly default: any;
|
|
30
|
+
};
|
|
31
|
+
/** The maximum duration to wait for a response. */
|
|
32
|
+
readonly trial_duration: {
|
|
33
|
+
readonly type: ParameterType.INT;
|
|
34
|
+
readonly pretty_name: "Trial duration";
|
|
35
|
+
readonly default: any;
|
|
36
|
+
};
|
|
37
|
+
/** Vertical margin of button. */
|
|
38
|
+
readonly margin_vertical: {
|
|
39
|
+
readonly type: ParameterType.STRING;
|
|
40
|
+
readonly pretty_name: "Margin vertical";
|
|
41
|
+
readonly default: "0px";
|
|
42
|
+
};
|
|
43
|
+
/** Horizontal margin of button. */
|
|
44
|
+
readonly margin_horizontal: {
|
|
45
|
+
readonly type: ParameterType.STRING;
|
|
46
|
+
readonly pretty_name: "Margin horizontal";
|
|
47
|
+
readonly default: "8px";
|
|
48
|
+
};
|
|
49
|
+
/** If true, the trial will end when user makes a response. */
|
|
50
|
+
readonly response_ends_trial: {
|
|
51
|
+
readonly type: ParameterType.BOOL;
|
|
52
|
+
readonly pretty_name: "Response ends trial";
|
|
53
|
+
readonly default: true;
|
|
54
|
+
};
|
|
55
|
+
/** If true, then the trial will end as soon as the audio file finishes playing. */
|
|
56
|
+
readonly trial_ends_after_audio: {
|
|
57
|
+
readonly type: ParameterType.BOOL;
|
|
58
|
+
readonly pretty_name: "Trial ends after audio";
|
|
59
|
+
readonly default: false;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* If true, then responses are allowed while the audio is playing.
|
|
63
|
+
* If false, then the audio must finish playing before a response is accepted.
|
|
64
|
+
*/
|
|
65
|
+
readonly response_allowed_while_playing: {
|
|
66
|
+
readonly type: ParameterType.BOOL;
|
|
67
|
+
readonly pretty_name: "Response allowed while playing";
|
|
68
|
+
readonly default: true;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type Info = typeof info;
|
|
73
|
+
/**
|
|
74
|
+
* **audio-button-response**
|
|
75
|
+
*
|
|
76
|
+
* jsPsych plugin for playing an audio file and getting a button response
|
|
77
|
+
*
|
|
78
|
+
* @author Kristin Diep
|
|
79
|
+
* @see {@link https://www.jspsych.org/plugins/jspsych-audio-button-response/ audio-button-response plugin documentation on jspsych.org}
|
|
80
|
+
*/
|
|
81
|
+
declare class AudioButtonResponsePlugin implements JsPsychPlugin<Info> {
|
|
82
|
+
private jsPsych;
|
|
83
|
+
static info: {
|
|
84
|
+
readonly name: "audio-button-response";
|
|
85
|
+
readonly parameters: {
|
|
86
|
+
/** The audio to be played. */
|
|
87
|
+
readonly stimulus: {
|
|
88
|
+
readonly type: ParameterType.AUDIO;
|
|
89
|
+
readonly pretty_name: "Stimulus";
|
|
90
|
+
readonly default: any;
|
|
91
|
+
};
|
|
92
|
+
/** Array containing the label(s) for the button(s). */
|
|
93
|
+
readonly choices: {
|
|
94
|
+
readonly type: ParameterType.STRING;
|
|
95
|
+
readonly pretty_name: "Choices";
|
|
96
|
+
readonly default: any;
|
|
97
|
+
readonly array: true;
|
|
98
|
+
};
|
|
99
|
+
/** The HTML for creating button. Can create own style. Use the "%choice%" string to indicate where the label from the choices parameter should be inserted. */
|
|
100
|
+
readonly button_html: {
|
|
101
|
+
readonly type: ParameterType.HTML_STRING;
|
|
102
|
+
readonly pretty_name: "Button HTML";
|
|
103
|
+
readonly default: "<button class=\"jspsych-btn\">%choice%</button>";
|
|
104
|
+
readonly array: true;
|
|
105
|
+
};
|
|
106
|
+
/** Any content here will be displayed below the stimulus. */
|
|
107
|
+
readonly prompt: {
|
|
108
|
+
readonly type: ParameterType.HTML_STRING;
|
|
109
|
+
readonly pretty_name: "Prompt";
|
|
110
|
+
readonly default: any;
|
|
111
|
+
};
|
|
112
|
+
/** The maximum duration to wait for a response. */
|
|
113
|
+
readonly trial_duration: {
|
|
114
|
+
readonly type: ParameterType.INT;
|
|
115
|
+
readonly pretty_name: "Trial duration";
|
|
116
|
+
readonly default: any;
|
|
117
|
+
};
|
|
118
|
+
/** Vertical margin of button. */
|
|
119
|
+
readonly margin_vertical: {
|
|
120
|
+
readonly type: ParameterType.STRING;
|
|
121
|
+
readonly pretty_name: "Margin vertical";
|
|
122
|
+
readonly default: "0px";
|
|
123
|
+
};
|
|
124
|
+
/** Horizontal margin of button. */
|
|
125
|
+
readonly margin_horizontal: {
|
|
126
|
+
readonly type: ParameterType.STRING;
|
|
127
|
+
readonly pretty_name: "Margin horizontal";
|
|
128
|
+
readonly default: "8px";
|
|
129
|
+
};
|
|
130
|
+
/** If true, the trial will end when user makes a response. */
|
|
131
|
+
readonly response_ends_trial: {
|
|
132
|
+
readonly type: ParameterType.BOOL;
|
|
133
|
+
readonly pretty_name: "Response ends trial";
|
|
134
|
+
readonly default: true;
|
|
135
|
+
};
|
|
136
|
+
/** If true, then the trial will end as soon as the audio file finishes playing. */
|
|
137
|
+
readonly trial_ends_after_audio: {
|
|
138
|
+
readonly type: ParameterType.BOOL;
|
|
139
|
+
readonly pretty_name: "Trial ends after audio";
|
|
140
|
+
readonly default: false;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* If true, then responses are allowed while the audio is playing.
|
|
144
|
+
* If false, then the audio must finish playing before a response is accepted.
|
|
145
|
+
*/
|
|
146
|
+
readonly response_allowed_while_playing: {
|
|
147
|
+
readonly type: ParameterType.BOOL;
|
|
148
|
+
readonly pretty_name: "Response allowed while playing";
|
|
149
|
+
readonly default: true;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
private audio;
|
|
154
|
+
constructor(jsPsych: JsPsych);
|
|
155
|
+
trial(display_element: HTMLElement, trial: TrialType<Info>, on_load: () => void): Promise<unknown>;
|
|
156
|
+
simulate(trial: TrialType<Info>, simulation_mode: any, simulation_options: any, load_callback: () => void): void;
|
|
157
|
+
private create_simulation_data;
|
|
158
|
+
private simulate_data_only;
|
|
159
|
+
private simulate_visual;
|
|
160
|
+
}
|
|
161
|
+
export default AudioButtonResponsePlugin;
|