jspsych 7.3.2 → 7.3.4
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 +9 -3
- package/css/jspsych.css +2 -4
- package/dist/JsPsych.d.ts +112 -112
- package/dist/TimelineNode.d.ts +34 -34
- package/dist/index.browser.js +4061 -3117
- 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 +4057 -3113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +4057 -3111
- package/dist/index.js.map +1 -1
- package/dist/migration.d.ts +3 -3
- package/dist/modules/data/DataCollection.d.ts +46 -46
- package/dist/modules/data/DataColumn.d.ts +15 -15
- package/dist/modules/data/index.d.ts +25 -25
- package/dist/modules/data/utils.d.ts +3 -3
- package/dist/modules/extensions.d.ts +22 -22
- package/dist/modules/plugin-api/HardwareAPI.d.ts +15 -15
- package/dist/modules/plugin-api/KeyboardListenerAPI.d.ts +34 -34
- package/dist/modules/plugin-api/MediaAPI.d.ts +32 -32
- package/dist/modules/plugin-api/SimulationAPI.d.ts +44 -41
- package/dist/modules/plugin-api/TimeoutAPI.d.ts +17 -5
- package/dist/modules/plugin-api/index.d.ts +8 -8
- package/dist/modules/plugins.d.ts +136 -136
- package/dist/modules/randomization.d.ts +42 -42
- package/dist/modules/turk.d.ts +40 -40
- package/dist/modules/utils.d.ts +13 -7
- package/package.json +3 -3
- package/src/JsPsych.ts +21 -8
- package/src/modules/plugin-api/SimulationAPI.ts +9 -4
- package/src/modules/plugin-api/TimeoutAPI.ts +15 -3
- package/src/modules/plugin-api/index.ts +14 -11
- package/src/modules/utils.ts +31 -0
package/README.md
CHANGED
|
@@ -48,9 +48,15 @@ See the [contributing to jsPsych](https://www.jspsych.org/latest/developers/cont
|
|
|
48
48
|
|
|
49
49
|
## Citation
|
|
50
50
|
|
|
51
|
-
If you use this library in academic work,
|
|
51
|
+
If you use this library in academic work, the preferred citation is:
|
|
52
52
|
|
|
53
|
-
de Leeuw, J.R. (
|
|
53
|
+
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://joss.theoj.org/papers/10.21105/joss.05351](https://joss.theoj.org/papers/10.21105/joss.05351).
|
|
54
|
+
|
|
55
|
+
This paper is an updated description of jsPsych and includes all current core team members. It replaces the earlier paper that described jsPsych:
|
|
56
|
+
|
|
57
|
+
de Leeuw, J.R. (2015). jsPsych: A JavaScript library for creating behavioral experiments in a Web browser. *Behavior Research Methods*, _47_(1), 1-12. doi:[10.3758/s13428-014-0458-y](http://link.springer.com/article/10.3758%2Fs13428-014-0458-y)
|
|
58
|
+
|
|
59
|
+
Citations help us demonstrate that this library is used and valued, which allows us to continue working on it.
|
|
54
60
|
|
|
55
61
|
## Contributors
|
|
56
62
|
|
|
@@ -59,4 +65,4 @@ The project is currently managed by the core team of Josh de Leeuw ([@jodeleeuw]
|
|
|
59
65
|
|
|
60
66
|
jsPsych was created by [Josh de Leeuw](http://www.twitter.com/joshdeleeuw).
|
|
61
67
|
|
|
62
|
-
We're also grateful for the generous support from a [Mozilla Open Source Support award](https://www.mozilla.org/en-US/moss/), which funded development of the library from 2020-
|
|
68
|
+
We're also grateful for the generous support from a [Mozilla Open Source Support award](https://www.mozilla.org/en-US/moss/), which funded development of the library from 2020-2022.
|
package/css/jspsych.css
CHANGED
|
@@ -330,11 +330,9 @@
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
.jspsych-content {
|
|
333
|
-
max-width: 95%;
|
|
334
|
-
/* this is mainly an IE 10-11 fix */
|
|
333
|
+
max-width: 95%; /* this is mainly an IE 10-11 fix */
|
|
335
334
|
text-align: center;
|
|
336
|
-
margin: auto;
|
|
337
|
-
/* this is for overflowing content */
|
|
335
|
+
margin: auto; /* this is for overflowing content */
|
|
338
336
|
}
|
|
339
337
|
|
|
340
338
|
.jspsych-top {
|
package/dist/JsPsych.d.ts
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { JsPsychData } from "./modules/data";
|
|
2
|
-
import { PluginAPI } from "./modules/plugin-api";
|
|
3
|
-
import * as randomization from "./modules/randomization";
|
|
4
|
-
import * as turk from "./modules/turk";
|
|
5
|
-
import * as utils from "./modules/utils";
|
|
6
|
-
export declare class JsPsych {
|
|
7
|
-
extensions: any;
|
|
8
|
-
turk: typeof turk;
|
|
9
|
-
randomization: typeof randomization;
|
|
10
|
-
utils: typeof utils;
|
|
11
|
-
data: JsPsychData;
|
|
12
|
-
pluginAPI: PluginAPI;
|
|
13
|
-
version(): any;
|
|
14
|
-
/**
|
|
15
|
-
* options
|
|
16
|
-
*/
|
|
17
|
-
private opts;
|
|
18
|
-
/**
|
|
19
|
-
* experiment timeline
|
|
20
|
-
*/
|
|
21
|
-
private timeline;
|
|
22
|
-
private timelineDescription;
|
|
23
|
-
private global_trial_index;
|
|
24
|
-
private current_trial;
|
|
25
|
-
private current_trial_finished;
|
|
26
|
-
private DOM_container;
|
|
27
|
-
private DOM_target;
|
|
28
|
-
/**
|
|
29
|
-
* time that the experiment began
|
|
30
|
-
*/
|
|
31
|
-
private exp_start_time;
|
|
32
|
-
/**
|
|
33
|
-
* is the experiment paused?
|
|
34
|
-
*/
|
|
35
|
-
private paused;
|
|
36
|
-
private waiting;
|
|
37
|
-
/**
|
|
38
|
-
* is the page retrieved directly via file:// protocol (true) or hosted on a server (false)?
|
|
39
|
-
*/
|
|
40
|
-
private file_protocol;
|
|
41
|
-
/**
|
|
42
|
-
* Promise that is resolved when `finishExperiment()` is called
|
|
43
|
-
*/
|
|
44
|
-
private finished;
|
|
45
|
-
private resolveFinishedPromise;
|
|
46
|
-
/**
|
|
47
|
-
* is the experiment running in `simulate()` mode
|
|
48
|
-
*/
|
|
49
|
-
private simulation_mode;
|
|
50
|
-
/**
|
|
51
|
-
* simulation options passed in via `simulate()`
|
|
52
|
-
*/
|
|
53
|
-
private simulation_options;
|
|
54
|
-
webaudio_context: AudioContext;
|
|
55
|
-
internal: {
|
|
56
|
-
/**
|
|
57
|
-
* this flag is used to determine whether we are in a scope where
|
|
58
|
-
* jsPsych.timelineVariable() should be executed immediately or
|
|
59
|
-
* whether it should return a function to access the variable later.
|
|
60
|
-
*
|
|
61
|
-
**/
|
|
62
|
-
call_immediate: boolean;
|
|
63
|
-
};
|
|
64
|
-
constructor(options?: any);
|
|
65
|
-
/**
|
|
66
|
-
* Starts an experiment using the provided timeline and returns a promise that is resolved when
|
|
67
|
-
* the experiment is finished.
|
|
68
|
-
*
|
|
69
|
-
* @param timeline The timeline to be run
|
|
70
|
-
*/
|
|
71
|
-
run(timeline: any[]): Promise<void>;
|
|
72
|
-
simulate(timeline: any[], simulation_mode?: "data-only" | "visual", simulation_options?: {}): Promise<void>;
|
|
73
|
-
getProgress(): {
|
|
74
|
-
total_trials: number;
|
|
75
|
-
current_trial_global: number;
|
|
76
|
-
percent_complete: number;
|
|
77
|
-
};
|
|
78
|
-
getStartTime(): any;
|
|
79
|
-
getTotalTime(): number;
|
|
80
|
-
getDisplayElement(): HTMLElement;
|
|
81
|
-
getDisplayContainerElement(): HTMLElement;
|
|
82
|
-
finishTrial(data?: {}): void;
|
|
83
|
-
endExperiment(end_message?: string, data?: {}): void;
|
|
84
|
-
endCurrentTimeline(): void;
|
|
85
|
-
getCurrentTrial(): any;
|
|
86
|
-
getInitSettings(): any;
|
|
87
|
-
getCurrentTimelineNodeID(): any;
|
|
88
|
-
timelineVariable(varname: string, immediate?: boolean): any;
|
|
89
|
-
getAllTimelineVariables(): any;
|
|
90
|
-
addNodeToEndOfTimeline(new_timeline: any, preload_callback?: any): void;
|
|
91
|
-
pauseExperiment(): void;
|
|
92
|
-
resumeExperiment(): void;
|
|
93
|
-
loadFail(message: any): void;
|
|
94
|
-
getSafeModeStatus(): boolean;
|
|
95
|
-
getTimeline(): any[];
|
|
96
|
-
private prepareDom;
|
|
97
|
-
private loadExtensions;
|
|
98
|
-
private startExperiment;
|
|
99
|
-
private finishExperiment;
|
|
100
|
-
private nextTrial;
|
|
101
|
-
private doTrial;
|
|
102
|
-
private evaluateTimelineVariables;
|
|
103
|
-
private evaluateFunctionParameters;
|
|
104
|
-
private replaceFunctionsWithValues;
|
|
105
|
-
private setDefaultValues;
|
|
106
|
-
private checkExclusions;
|
|
107
|
-
private drawProgressBar;
|
|
108
|
-
private updateProgressBar;
|
|
109
|
-
private progress_bar_amount;
|
|
110
|
-
setProgressBar(proportion_complete: any): void;
|
|
111
|
-
getProgressBarCompleted(): number;
|
|
112
|
-
}
|
|
1
|
+
import { JsPsychData } from "./modules/data";
|
|
2
|
+
import { PluginAPI } from "./modules/plugin-api";
|
|
3
|
+
import * as randomization from "./modules/randomization";
|
|
4
|
+
import * as turk from "./modules/turk";
|
|
5
|
+
import * as utils from "./modules/utils";
|
|
6
|
+
export declare class JsPsych {
|
|
7
|
+
extensions: any;
|
|
8
|
+
turk: typeof turk;
|
|
9
|
+
randomization: typeof randomization;
|
|
10
|
+
utils: typeof utils;
|
|
11
|
+
data: JsPsychData;
|
|
12
|
+
pluginAPI: PluginAPI;
|
|
13
|
+
version(): any;
|
|
14
|
+
/**
|
|
15
|
+
* options
|
|
16
|
+
*/
|
|
17
|
+
private opts;
|
|
18
|
+
/**
|
|
19
|
+
* experiment timeline
|
|
20
|
+
*/
|
|
21
|
+
private timeline;
|
|
22
|
+
private timelineDescription;
|
|
23
|
+
private global_trial_index;
|
|
24
|
+
private current_trial;
|
|
25
|
+
private current_trial_finished;
|
|
26
|
+
private DOM_container;
|
|
27
|
+
private DOM_target;
|
|
28
|
+
/**
|
|
29
|
+
* time that the experiment began
|
|
30
|
+
*/
|
|
31
|
+
private exp_start_time;
|
|
32
|
+
/**
|
|
33
|
+
* is the experiment paused?
|
|
34
|
+
*/
|
|
35
|
+
private paused;
|
|
36
|
+
private waiting;
|
|
37
|
+
/**
|
|
38
|
+
* is the page retrieved directly via file:// protocol (true) or hosted on a server (false)?
|
|
39
|
+
*/
|
|
40
|
+
private file_protocol;
|
|
41
|
+
/**
|
|
42
|
+
* Promise that is resolved when `finishExperiment()` is called
|
|
43
|
+
*/
|
|
44
|
+
private finished;
|
|
45
|
+
private resolveFinishedPromise;
|
|
46
|
+
/**
|
|
47
|
+
* is the experiment running in `simulate()` mode
|
|
48
|
+
*/
|
|
49
|
+
private simulation_mode;
|
|
50
|
+
/**
|
|
51
|
+
* simulation options passed in via `simulate()`
|
|
52
|
+
*/
|
|
53
|
+
private simulation_options;
|
|
54
|
+
webaudio_context: AudioContext;
|
|
55
|
+
internal: {
|
|
56
|
+
/**
|
|
57
|
+
* this flag is used to determine whether we are in a scope where
|
|
58
|
+
* jsPsych.timelineVariable() should be executed immediately or
|
|
59
|
+
* whether it should return a function to access the variable later.
|
|
60
|
+
*
|
|
61
|
+
**/
|
|
62
|
+
call_immediate: boolean;
|
|
63
|
+
};
|
|
64
|
+
constructor(options?: any);
|
|
65
|
+
/**
|
|
66
|
+
* Starts an experiment using the provided timeline and returns a promise that is resolved when
|
|
67
|
+
* the experiment is finished.
|
|
68
|
+
*
|
|
69
|
+
* @param timeline The timeline to be run
|
|
70
|
+
*/
|
|
71
|
+
run(timeline: any[]): Promise<void>;
|
|
72
|
+
simulate(timeline: any[], simulation_mode?: "data-only" | "visual", simulation_options?: {}): Promise<void>;
|
|
73
|
+
getProgress(): {
|
|
74
|
+
total_trials: number;
|
|
75
|
+
current_trial_global: number;
|
|
76
|
+
percent_complete: number;
|
|
77
|
+
};
|
|
78
|
+
getStartTime(): any;
|
|
79
|
+
getTotalTime(): number;
|
|
80
|
+
getDisplayElement(): HTMLElement;
|
|
81
|
+
getDisplayContainerElement(): HTMLElement;
|
|
82
|
+
finishTrial(data?: {}): void;
|
|
83
|
+
endExperiment(end_message?: string, data?: {}): void;
|
|
84
|
+
endCurrentTimeline(): void;
|
|
85
|
+
getCurrentTrial(): any;
|
|
86
|
+
getInitSettings(): any;
|
|
87
|
+
getCurrentTimelineNodeID(): any;
|
|
88
|
+
timelineVariable(varname: string, immediate?: boolean): any;
|
|
89
|
+
getAllTimelineVariables(): any;
|
|
90
|
+
addNodeToEndOfTimeline(new_timeline: any, preload_callback?: any): void;
|
|
91
|
+
pauseExperiment(): void;
|
|
92
|
+
resumeExperiment(): void;
|
|
93
|
+
loadFail(message: any): void;
|
|
94
|
+
getSafeModeStatus(): boolean;
|
|
95
|
+
getTimeline(): any[];
|
|
96
|
+
private prepareDom;
|
|
97
|
+
private loadExtensions;
|
|
98
|
+
private startExperiment;
|
|
99
|
+
private finishExperiment;
|
|
100
|
+
private nextTrial;
|
|
101
|
+
private doTrial;
|
|
102
|
+
private evaluateTimelineVariables;
|
|
103
|
+
private evaluateFunctionParameters;
|
|
104
|
+
private replaceFunctionsWithValues;
|
|
105
|
+
private setDefaultValues;
|
|
106
|
+
private checkExclusions;
|
|
107
|
+
private drawProgressBar;
|
|
108
|
+
private updateProgressBar;
|
|
109
|
+
private progress_bar_amount;
|
|
110
|
+
setProgressBar(proportion_complete: any): void;
|
|
111
|
+
getProgressBarCompleted(): number;
|
|
112
|
+
}
|
package/dist/TimelineNode.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { JsPsych } from "./JsPsych";
|
|
2
|
-
export declare class TimelineNode {
|
|
3
|
-
private jsPsych;
|
|
4
|
-
relative_id: any;
|
|
5
|
-
parent_node: any;
|
|
6
|
-
trial_parameters: any;
|
|
7
|
-
timeline_parameters: any;
|
|
8
|
-
node_trial_data: any;
|
|
9
|
-
progress: any;
|
|
10
|
-
end_message?: string;
|
|
11
|
-
constructor(jsPsych: JsPsych, parameters: any, parent?: any, relativeID?: any);
|
|
12
|
-
trial(): any;
|
|
13
|
-
markCurrentTrialComplete(): void;
|
|
14
|
-
nextRepetiton(): void;
|
|
15
|
-
setTimelineVariablesOrder(): void;
|
|
16
|
-
nextSet(): void;
|
|
17
|
-
advance(): any;
|
|
18
|
-
isComplete(): any;
|
|
19
|
-
getTimelineVariableValue(variable_name: string): any;
|
|
20
|
-
findTimelineVariable(variable_name: any): any;
|
|
21
|
-
timelineVariable(variable_name: string): any;
|
|
22
|
-
allTimelineVariables(): any;
|
|
23
|
-
allTimelineVariablesNames(so_far?: any[]): any;
|
|
24
|
-
length(): number;
|
|
25
|
-
percentComplete(): number;
|
|
26
|
-
reset(): void;
|
|
27
|
-
end(): void;
|
|
28
|
-
endActiveNode(): void;
|
|
29
|
-
ID(): string;
|
|
30
|
-
activeID(): any;
|
|
31
|
-
generatedData(): import("./modules/data/DataCollection").DataCollection;
|
|
32
|
-
trialsOfType(type: any): any;
|
|
33
|
-
insert(parameters: any): void;
|
|
34
|
-
}
|
|
1
|
+
import { JsPsych } from "./JsPsych";
|
|
2
|
+
export declare class TimelineNode {
|
|
3
|
+
private jsPsych;
|
|
4
|
+
relative_id: any;
|
|
5
|
+
parent_node: any;
|
|
6
|
+
trial_parameters: any;
|
|
7
|
+
timeline_parameters: any;
|
|
8
|
+
node_trial_data: any;
|
|
9
|
+
progress: any;
|
|
10
|
+
end_message?: string;
|
|
11
|
+
constructor(jsPsych: JsPsych, parameters: any, parent?: any, relativeID?: any);
|
|
12
|
+
trial(): any;
|
|
13
|
+
markCurrentTrialComplete(): void;
|
|
14
|
+
nextRepetiton(): void;
|
|
15
|
+
setTimelineVariablesOrder(): void;
|
|
16
|
+
nextSet(): void;
|
|
17
|
+
advance(): any;
|
|
18
|
+
isComplete(): any;
|
|
19
|
+
getTimelineVariableValue(variable_name: string): any;
|
|
20
|
+
findTimelineVariable(variable_name: any): any;
|
|
21
|
+
timelineVariable(variable_name: string): any;
|
|
22
|
+
allTimelineVariables(): any;
|
|
23
|
+
allTimelineVariablesNames(so_far?: any[]): any;
|
|
24
|
+
length(): number;
|
|
25
|
+
percentComplete(): number;
|
|
26
|
+
reset(): void;
|
|
27
|
+
end(): void;
|
|
28
|
+
endActiveNode(): void;
|
|
29
|
+
ID(): string;
|
|
30
|
+
activeID(): any;
|
|
31
|
+
generatedData(): import("./modules/data/DataCollection").DataCollection;
|
|
32
|
+
trialsOfType(type: any): any;
|
|
33
|
+
insert(parameters: any): void;
|
|
34
|
+
}
|