jspsych 7.3.3 → 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/css/jspsych.css +2 -4
- package/dist/JsPsych.d.ts +112 -112
- package/dist/TimelineNode.d.ts +34 -34
- package/dist/index.browser.js +4060 -3171
- 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 +4056 -3167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +4056 -3165
- 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 -44
- package/dist/modules/plugin-api/TimeoutAPI.d.ts +17 -17
- 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 -13
- package/package.json +2 -2
package/dist/migration.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class MigrationError extends Error {
|
|
2
|
-
constructor(message?: string);
|
|
3
|
-
}
|
|
1
|
+
export declare class MigrationError extends Error {
|
|
2
|
+
constructor(message?: string);
|
|
3
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { DataColumn } from "./DataColumn";
|
|
2
|
-
export declare class DataCollection {
|
|
3
|
-
private trials;
|
|
4
|
-
constructor(data?: any[]);
|
|
5
|
-
push(new_data: any): this;
|
|
6
|
-
join(other_data_collection: DataCollection): this;
|
|
7
|
-
top(): DataCollection;
|
|
8
|
-
/**
|
|
9
|
-
* Queries the first n elements in a collection of trials.
|
|
10
|
-
*
|
|
11
|
-
* @param n A positive integer of elements to return. A value of
|
|
12
|
-
* n that is less than 1 will throw an error.
|
|
13
|
-
*
|
|
14
|
-
* @return First n objects of a collection of trials. If fewer than
|
|
15
|
-
* n trials are available, the trials.length elements will
|
|
16
|
-
* be returned.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
first(n?: number): DataCollection;
|
|
20
|
-
/**
|
|
21
|
-
* Queries the last n elements in a collection of trials.
|
|
22
|
-
*
|
|
23
|
-
* @param n A positive integer of elements to return. A value of
|
|
24
|
-
* n that is less than 1 will throw an error.
|
|
25
|
-
*
|
|
26
|
-
* @return Last n objects of a collection of trials. If fewer than
|
|
27
|
-
* n trials are available, the trials.length elements will
|
|
28
|
-
* be returned.
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
last(n?: number): DataCollection;
|
|
32
|
-
values(): any[];
|
|
33
|
-
count(): number;
|
|
34
|
-
readOnly(): DataCollection;
|
|
35
|
-
addToAll(properties: any): this;
|
|
36
|
-
addToLast(properties: any): this;
|
|
37
|
-
filter(filters: any): DataCollection;
|
|
38
|
-
filterCustom(fn: any): DataCollection;
|
|
39
|
-
filterColumns(columns: Array<string>): DataCollection;
|
|
40
|
-
select(column: any): DataColumn;
|
|
41
|
-
ignore(columns: any): DataCollection;
|
|
42
|
-
uniqueNames(): any[];
|
|
43
|
-
csv(): string;
|
|
44
|
-
json(pretty?: boolean): string;
|
|
45
|
-
localSave(format: any, filename: any): void;
|
|
46
|
-
}
|
|
1
|
+
import { DataColumn } from "./DataColumn";
|
|
2
|
+
export declare class DataCollection {
|
|
3
|
+
private trials;
|
|
4
|
+
constructor(data?: any[]);
|
|
5
|
+
push(new_data: any): this;
|
|
6
|
+
join(other_data_collection: DataCollection): this;
|
|
7
|
+
top(): DataCollection;
|
|
8
|
+
/**
|
|
9
|
+
* Queries the first n elements in a collection of trials.
|
|
10
|
+
*
|
|
11
|
+
* @param n A positive integer of elements to return. A value of
|
|
12
|
+
* n that is less than 1 will throw an error.
|
|
13
|
+
*
|
|
14
|
+
* @return First n objects of a collection of trials. If fewer than
|
|
15
|
+
* n trials are available, the trials.length elements will
|
|
16
|
+
* be returned.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
first(n?: number): DataCollection;
|
|
20
|
+
/**
|
|
21
|
+
* Queries the last n elements in a collection of trials.
|
|
22
|
+
*
|
|
23
|
+
* @param n A positive integer of elements to return. A value of
|
|
24
|
+
* n that is less than 1 will throw an error.
|
|
25
|
+
*
|
|
26
|
+
* @return Last n objects of a collection of trials. If fewer than
|
|
27
|
+
* n trials are available, the trials.length elements will
|
|
28
|
+
* be returned.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
last(n?: number): DataCollection;
|
|
32
|
+
values(): any[];
|
|
33
|
+
count(): number;
|
|
34
|
+
readOnly(): DataCollection;
|
|
35
|
+
addToAll(properties: any): this;
|
|
36
|
+
addToLast(properties: any): this;
|
|
37
|
+
filter(filters: any): DataCollection;
|
|
38
|
+
filterCustom(fn: any): DataCollection;
|
|
39
|
+
filterColumns(columns: Array<string>): DataCollection;
|
|
40
|
+
select(column: any): DataColumn;
|
|
41
|
+
ignore(columns: any): DataCollection;
|
|
42
|
+
uniqueNames(): any[];
|
|
43
|
+
csv(): string;
|
|
44
|
+
json(pretty?: boolean): string;
|
|
45
|
+
localSave(format: any, filename: any): void;
|
|
46
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare class DataColumn {
|
|
2
|
-
values: any[];
|
|
3
|
-
constructor(values?: any[]);
|
|
4
|
-
sum(): number;
|
|
5
|
-
mean(): number;
|
|
6
|
-
median(): any;
|
|
7
|
-
min(): any;
|
|
8
|
-
max(): any;
|
|
9
|
-
count(): number;
|
|
10
|
-
variance(): number;
|
|
11
|
-
sd(): number;
|
|
12
|
-
frequencies(): {};
|
|
13
|
-
all(eval_fn: any): boolean;
|
|
14
|
-
subset(eval_fn: any): DataColumn;
|
|
15
|
-
}
|
|
1
|
+
export declare class DataColumn {
|
|
2
|
+
values: any[];
|
|
3
|
+
constructor(values?: any[]);
|
|
4
|
+
sum(): number;
|
|
5
|
+
mean(): number;
|
|
6
|
+
median(): any;
|
|
7
|
+
min(): any;
|
|
8
|
+
max(): any;
|
|
9
|
+
count(): number;
|
|
10
|
+
variance(): number;
|
|
11
|
+
sd(): number;
|
|
12
|
+
frequencies(): {};
|
|
13
|
+
all(eval_fn: any): boolean;
|
|
14
|
+
subset(eval_fn: any): DataColumn;
|
|
15
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { JsPsych } from "../../JsPsych";
|
|
2
|
-
import { DataCollection } from "./DataCollection";
|
|
3
|
-
export declare class JsPsychData {
|
|
4
|
-
private jsPsych;
|
|
5
|
-
private allData;
|
|
6
|
-
private interactionData;
|
|
7
|
-
private dataProperties;
|
|
8
|
-
private query_string;
|
|
9
|
-
constructor(jsPsych: JsPsych);
|
|
10
|
-
reset(): void;
|
|
11
|
-
get(): DataCollection;
|
|
12
|
-
getInteractionData(): DataCollection;
|
|
13
|
-
write(data_object: any): void;
|
|
14
|
-
addProperties(properties: any): void;
|
|
15
|
-
addDataToLastTrial(data: any): void;
|
|
16
|
-
getDataByTimelineNode(node_id: any): DataCollection;
|
|
17
|
-
getLastTrialData(): DataCollection;
|
|
18
|
-
getLastTimelineData(): DataCollection;
|
|
19
|
-
displayData(format?: string): void;
|
|
20
|
-
urlVariables(): any;
|
|
21
|
-
getURLVariable(whichvar: any): any;
|
|
22
|
-
createInteractionListeners(): void;
|
|
23
|
-
_customInsert(data: any): void;
|
|
24
|
-
_fullreset(): void;
|
|
25
|
-
}
|
|
1
|
+
import { JsPsych } from "../../JsPsych";
|
|
2
|
+
import { DataCollection } from "./DataCollection";
|
|
3
|
+
export declare class JsPsychData {
|
|
4
|
+
private jsPsych;
|
|
5
|
+
private allData;
|
|
6
|
+
private interactionData;
|
|
7
|
+
private dataProperties;
|
|
8
|
+
private query_string;
|
|
9
|
+
constructor(jsPsych: JsPsych);
|
|
10
|
+
reset(): void;
|
|
11
|
+
get(): DataCollection;
|
|
12
|
+
getInteractionData(): DataCollection;
|
|
13
|
+
write(data_object: any): void;
|
|
14
|
+
addProperties(properties: any): void;
|
|
15
|
+
addDataToLastTrial(data: any): void;
|
|
16
|
+
getDataByTimelineNode(node_id: any): DataCollection;
|
|
17
|
+
getLastTrialData(): DataCollection;
|
|
18
|
+
getLastTimelineData(): DataCollection;
|
|
19
|
+
displayData(format?: string): void;
|
|
20
|
+
urlVariables(): any;
|
|
21
|
+
getURLVariable(whichvar: any): any;
|
|
22
|
+
createInteractionListeners(): void;
|
|
23
|
+
_customInsert(data: any): void;
|
|
24
|
+
_fullreset(): void;
|
|
25
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function saveTextToFile(textstr: string, filename: string): void;
|
|
2
|
-
export declare function JSON2CSV(objArray: any): string;
|
|
3
|
-
export declare function getQueryString(): {};
|
|
1
|
+
export declare function saveTextToFile(textstr: string, filename: string): void;
|
|
2
|
+
export declare function JSON2CSV(objArray: any): string;
|
|
3
|
+
export declare function getQueryString(): {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export interface JsPsychExtensionInfo {
|
|
2
|
-
name: string;
|
|
3
|
-
}
|
|
4
|
-
export interface JsPsychExtension {
|
|
5
|
-
/**
|
|
6
|
-
* Called once at the start of the experiment to initialize the extension
|
|
7
|
-
*/
|
|
8
|
-
initialize(params?: Record<string, any>): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* Called at the start of a trial, prior to invoking the plugin's trial method.
|
|
11
|
-
*/
|
|
12
|
-
on_start(params?: Record<string, any>): void;
|
|
13
|
-
/**
|
|
14
|
-
* Called during a trial, after the plugin makes initial changes to the DOM.
|
|
15
|
-
*/
|
|
16
|
-
on_load(params?: Record<string, any>): void;
|
|
17
|
-
/**
|
|
18
|
-
* Called at the end of the trial.
|
|
19
|
-
* @returns Data to append to the trial's data object.
|
|
20
|
-
*/
|
|
21
|
-
on_finish(params?: Record<string, any>): Record<string, any> | Promise<Record<string, any>>;
|
|
22
|
-
}
|
|
1
|
+
export interface JsPsychExtensionInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
}
|
|
4
|
+
export interface JsPsychExtension {
|
|
5
|
+
/**
|
|
6
|
+
* Called once at the start of the experiment to initialize the extension
|
|
7
|
+
*/
|
|
8
|
+
initialize(params?: Record<string, any>): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Called at the start of a trial, prior to invoking the plugin's trial method.
|
|
11
|
+
*/
|
|
12
|
+
on_start(params?: Record<string, any>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Called during a trial, after the plugin makes initial changes to the DOM.
|
|
15
|
+
*/
|
|
16
|
+
on_load(params?: Record<string, any>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Called at the end of the trial.
|
|
19
|
+
* @returns Data to append to the trial's data object.
|
|
20
|
+
*/
|
|
21
|
+
on_finish(params?: Record<string, any>): Record<string, any> | Promise<Record<string, any>>;
|
|
22
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare class HardwareAPI {
|
|
2
|
-
/**
|
|
3
|
-
* Indicates whether this instance of jspsych has opened a hardware connection through our browser
|
|
4
|
-
* extension
|
|
5
|
-
**/
|
|
6
|
-
hardwareConnected: boolean;
|
|
7
|
-
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* Allows communication with user hardware through our custom Google Chrome extension + native C++ program
|
|
10
|
-
* @param mess The message to be passed to our extension, see its documentation for the expected members of this object.
|
|
11
|
-
* @author Daniel Rivas
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
hardware(mess: any): void;
|
|
15
|
-
}
|
|
1
|
+
export declare class HardwareAPI {
|
|
2
|
+
/**
|
|
3
|
+
* Indicates whether this instance of jspsych has opened a hardware connection through our browser
|
|
4
|
+
* extension
|
|
5
|
+
**/
|
|
6
|
+
hardwareConnected: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Allows communication with user hardware through our custom Google Chrome extension + native C++ program
|
|
10
|
+
* @param mess The message to be passed to our extension, see its documentation for the expected members of this object.
|
|
11
|
+
* @author Daniel Rivas
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
hardware(mess: any): void;
|
|
15
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export interface GetKeyboardResponseOptions {
|
|
4
|
-
callback_function: any;
|
|
5
|
-
valid_responses?: ValidResponses;
|
|
6
|
-
rt_method?: "performance" | "audio";
|
|
7
|
-
persist?: boolean;
|
|
8
|
-
audio_context?: AudioContext;
|
|
9
|
-
audio_context_start_time?: number;
|
|
10
|
-
allow_held_key?: boolean;
|
|
11
|
-
minimum_valid_rt?: number;
|
|
12
|
-
}
|
|
13
|
-
export declare class KeyboardListenerAPI {
|
|
14
|
-
private getRootElement;
|
|
15
|
-
private areResponsesCaseSensitive;
|
|
16
|
-
private minimumValidRt;
|
|
17
|
-
constructor(getRootElement: () => Element | undefined, areResponsesCaseSensitive?: boolean, minimumValidRt?: number);
|
|
18
|
-
private listeners;
|
|
19
|
-
private heldKeys;
|
|
20
|
-
private areRootListenersRegistered;
|
|
21
|
-
/**
|
|
22
|
-
* If not previously done and `this.getRootElement()` returns an element, adds the root key
|
|
23
|
-
* listeners to that element.
|
|
24
|
-
*/
|
|
25
|
-
private registerRootListeners;
|
|
26
|
-
private rootKeydownListener;
|
|
27
|
-
private toLowerCaseIfInsensitive;
|
|
28
|
-
private rootKeyupListener;
|
|
29
|
-
private isResponseValid;
|
|
30
|
-
getKeyboardResponse({ callback_function, valid_responses, rt_method, persist, audio_context, audio_context_start_time, allow_held_key, minimum_valid_rt, }: GetKeyboardResponseOptions): KeyboardListener;
|
|
31
|
-
cancelKeyboardResponse(listener: KeyboardListener): void;
|
|
32
|
-
cancelAllKeyboardResponses(): void;
|
|
33
|
-
compareKeys(key1: string | null, key2: string | null): boolean;
|
|
34
|
-
}
|
|
1
|
+
export type KeyboardListener = (e: KeyboardEvent) => void;
|
|
2
|
+
export type ValidResponses = string[] | "ALL_KEYS" | "NO_KEYS";
|
|
3
|
+
export interface GetKeyboardResponseOptions {
|
|
4
|
+
callback_function: any;
|
|
5
|
+
valid_responses?: ValidResponses;
|
|
6
|
+
rt_method?: "performance" | "audio";
|
|
7
|
+
persist?: boolean;
|
|
8
|
+
audio_context?: AudioContext;
|
|
9
|
+
audio_context_start_time?: number;
|
|
10
|
+
allow_held_key?: boolean;
|
|
11
|
+
minimum_valid_rt?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class KeyboardListenerAPI {
|
|
14
|
+
private getRootElement;
|
|
15
|
+
private areResponsesCaseSensitive;
|
|
16
|
+
private minimumValidRt;
|
|
17
|
+
constructor(getRootElement: () => Element | undefined, areResponsesCaseSensitive?: boolean, minimumValidRt?: number);
|
|
18
|
+
private listeners;
|
|
19
|
+
private heldKeys;
|
|
20
|
+
private areRootListenersRegistered;
|
|
21
|
+
/**
|
|
22
|
+
* If not previously done and `this.getRootElement()` returns an element, adds the root key
|
|
23
|
+
* listeners to that element.
|
|
24
|
+
*/
|
|
25
|
+
private registerRootListeners;
|
|
26
|
+
private rootKeydownListener;
|
|
27
|
+
private toLowerCaseIfInsensitive;
|
|
28
|
+
private rootKeyupListener;
|
|
29
|
+
private isResponseValid;
|
|
30
|
+
getKeyboardResponse({ callback_function, valid_responses, rt_method, persist, audio_context, audio_context_start_time, allow_held_key, minimum_valid_rt, }: GetKeyboardResponseOptions): KeyboardListener;
|
|
31
|
+
cancelKeyboardResponse(listener: KeyboardListener): void;
|
|
32
|
+
cancelAllKeyboardResponses(): void;
|
|
33
|
+
compareKeys(key1: string | null, key2: string | null): boolean;
|
|
34
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export declare class MediaAPI {
|
|
2
|
-
private useWebaudio;
|
|
3
|
-
private webaudioContext?;
|
|
4
|
-
constructor(useWebaudio: boolean, webaudioContext?: AudioContext);
|
|
5
|
-
private video_buffers;
|
|
6
|
-
getVideoBuffer(videoID: string): any;
|
|
7
|
-
private context;
|
|
8
|
-
private audio_buffers;
|
|
9
|
-
initAudio(): void;
|
|
10
|
-
audioContext(): any;
|
|
11
|
-
getAudioBuffer(audioID: any): Promise<unknown>;
|
|
12
|
-
private preload_requests;
|
|
13
|
-
private img_cache;
|
|
14
|
-
preloadAudio(files: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
15
|
-
preloadImages(images: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
16
|
-
preloadVideo(videos: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
17
|
-
private preloadMap;
|
|
18
|
-
getAutoPreloadList(timeline_description: any[]): {
|
|
19
|
-
images: string[];
|
|
20
|
-
audio: string[];
|
|
21
|
-
video: string[];
|
|
22
|
-
};
|
|
23
|
-
cancelPreloads(): void;
|
|
24
|
-
private microphone_recorder;
|
|
25
|
-
initializeMicrophoneRecorder(stream: MediaStream): void;
|
|
26
|
-
getMicrophoneRecorder(): MediaRecorder;
|
|
27
|
-
private camera_stream;
|
|
28
|
-
private camera_recorder;
|
|
29
|
-
initializeCameraRecorder(stream: MediaStream, opts?: MediaRecorderOptions): void;
|
|
30
|
-
getCameraStream(): MediaStream;
|
|
31
|
-
getCameraRecorder(): MediaRecorder;
|
|
32
|
-
}
|
|
1
|
+
export declare class MediaAPI {
|
|
2
|
+
private useWebaudio;
|
|
3
|
+
private webaudioContext?;
|
|
4
|
+
constructor(useWebaudio: boolean, webaudioContext?: AudioContext);
|
|
5
|
+
private video_buffers;
|
|
6
|
+
getVideoBuffer(videoID: string): any;
|
|
7
|
+
private context;
|
|
8
|
+
private audio_buffers;
|
|
9
|
+
initAudio(): void;
|
|
10
|
+
audioContext(): any;
|
|
11
|
+
getAudioBuffer(audioID: any): Promise<unknown>;
|
|
12
|
+
private preload_requests;
|
|
13
|
+
private img_cache;
|
|
14
|
+
preloadAudio(files: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
15
|
+
preloadImages(images: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
16
|
+
preloadVideo(videos: any, callback_complete?: () => void, callback_load?: (filepath: any) => void, callback_error?: (error_msg: any) => void): void;
|
|
17
|
+
private preloadMap;
|
|
18
|
+
getAutoPreloadList(timeline_description: any[]): {
|
|
19
|
+
images: string[];
|
|
20
|
+
audio: string[];
|
|
21
|
+
video: string[];
|
|
22
|
+
};
|
|
23
|
+
cancelPreloads(): void;
|
|
24
|
+
private microphone_recorder;
|
|
25
|
+
initializeMicrophoneRecorder(stream: MediaStream): void;
|
|
26
|
+
getMicrophoneRecorder(): MediaRecorder;
|
|
27
|
+
private camera_stream;
|
|
28
|
+
private camera_recorder;
|
|
29
|
+
initializeCameraRecorder(stream: MediaStream, opts?: MediaRecorderOptions): void;
|
|
30
|
+
getCameraStream(): MediaStream;
|
|
31
|
+
getCameraRecorder(): MediaRecorder;
|
|
32
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export declare class SimulationAPI {
|
|
2
|
-
private getDisplayContainerElement;
|
|
3
|
-
private setJsPsychTimeout;
|
|
4
|
-
constructor(getDisplayContainerElement: () => HTMLElement, setJsPsychTimeout: (callback: () => void, delay: number) => number);
|
|
5
|
-
dispatchEvent(event: Event): void;
|
|
6
|
-
/**
|
|
7
|
-
* Dispatches a `keydown` event for the specified key
|
|
8
|
-
* @param key Character code (`.key` property) for the key to press.
|
|
9
|
-
*/
|
|
10
|
-
keyDown(key: string): void;
|
|
11
|
-
/**
|
|
12
|
-
* Dispatches a `keyup` event for the specified key
|
|
13
|
-
* @param key Character code (`.key` property) for the key to press.
|
|
14
|
-
*/
|
|
15
|
-
keyUp(key: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Dispatches a `keydown` and `keyup` event in sequence to simulate pressing a key.
|
|
18
|
-
* @param key Character code (`.key` property) for the key to press.
|
|
19
|
-
* @param delay Length of time to wait (ms) before executing action
|
|
20
|
-
*/
|
|
21
|
-
pressKey(key: string, delay?: number): void;
|
|
22
|
-
/**
|
|
23
|
-
* Dispatches `mousedown`, `mouseup`, and `click` events on the target element
|
|
24
|
-
* @param target The element to click
|
|
25
|
-
* @param delay Length of time to wait (ms) before executing action
|
|
26
|
-
*/
|
|
27
|
-
clickTarget(target: Element, delay?: number): void;
|
|
28
|
-
/**
|
|
29
|
-
* Sets the value of a target text input
|
|
30
|
-
* @param target A text input element to fill in
|
|
31
|
-
* @param text Text to input
|
|
32
|
-
* @param delay Length of time to wait (ms) before executing action
|
|
33
|
-
*/
|
|
34
|
-
fillTextInput(target: HTMLInputElement, text: string, delay?: number): void;
|
|
35
|
-
/**
|
|
36
|
-
* Picks a valid key from `choices`, taking into account jsPsych-specific
|
|
37
|
-
* identifiers like "NO_KEYS" and "ALL_KEYS".
|
|
38
|
-
* @param choices Which keys are valid.
|
|
39
|
-
* @returns A key selected at random from the valid keys.
|
|
40
|
-
*/
|
|
41
|
-
getValidKey(choices: "NO_KEYS" | "ALL_KEYS" | Array<string> | Array<Array<string>>): any;
|
|
42
|
-
mergeSimulationData(default_data: any, simulation_options: any): any;
|
|
43
|
-
ensureSimulationDataConsistency(trial: any, data: any): void;
|
|
44
|
-
}
|
|
1
|
+
export declare class SimulationAPI {
|
|
2
|
+
private getDisplayContainerElement;
|
|
3
|
+
private setJsPsychTimeout;
|
|
4
|
+
constructor(getDisplayContainerElement: () => HTMLElement, setJsPsychTimeout: (callback: () => void, delay: number) => number);
|
|
5
|
+
dispatchEvent(event: Event): void;
|
|
6
|
+
/**
|
|
7
|
+
* Dispatches a `keydown` event for the specified key
|
|
8
|
+
* @param key Character code (`.key` property) for the key to press.
|
|
9
|
+
*/
|
|
10
|
+
keyDown(key: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Dispatches a `keyup` event for the specified key
|
|
13
|
+
* @param key Character code (`.key` property) for the key to press.
|
|
14
|
+
*/
|
|
15
|
+
keyUp(key: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Dispatches a `keydown` and `keyup` event in sequence to simulate pressing a key.
|
|
18
|
+
* @param key Character code (`.key` property) for the key to press.
|
|
19
|
+
* @param delay Length of time to wait (ms) before executing action
|
|
20
|
+
*/
|
|
21
|
+
pressKey(key: string, delay?: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Dispatches `mousedown`, `mouseup`, and `click` events on the target element
|
|
24
|
+
* @param target The element to click
|
|
25
|
+
* @param delay Length of time to wait (ms) before executing action
|
|
26
|
+
*/
|
|
27
|
+
clickTarget(target: Element, delay?: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the value of a target text input
|
|
30
|
+
* @param target A text input element to fill in
|
|
31
|
+
* @param text Text to input
|
|
32
|
+
* @param delay Length of time to wait (ms) before executing action
|
|
33
|
+
*/
|
|
34
|
+
fillTextInput(target: HTMLInputElement, text: string, delay?: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Picks a valid key from `choices`, taking into account jsPsych-specific
|
|
37
|
+
* identifiers like "NO_KEYS" and "ALL_KEYS".
|
|
38
|
+
* @param choices Which keys are valid.
|
|
39
|
+
* @returns A key selected at random from the valid keys.
|
|
40
|
+
*/
|
|
41
|
+
getValidKey(choices: "NO_KEYS" | "ALL_KEYS" | Array<string> | Array<Array<string>>): any;
|
|
42
|
+
mergeSimulationData(default_data: any, simulation_options: any): any;
|
|
43
|
+
ensureSimulationDataConsistency(trial: any, data: any): void;
|
|
44
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class that provides a wrapper around the global setTimeout and clearTimeout functions.
|
|
3
|
-
*/
|
|
4
|
-
export declare class TimeoutAPI {
|
|
5
|
-
private timeout_handlers;
|
|
6
|
-
/**
|
|
7
|
-
* Calls a function after a specified delay, in milliseconds.
|
|
8
|
-
* @param callback The function to call after the delay.
|
|
9
|
-
* @param delay The number of milliseconds to wait before calling the function.
|
|
10
|
-
* @returns A handle that can be used to clear the timeout with clearTimeout.
|
|
11
|
-
*/
|
|
12
|
-
setTimeout(callback: () => void, delay: number): number;
|
|
13
|
-
/**
|
|
14
|
-
* Clears all timeouts that have been created with setTimeout.
|
|
15
|
-
*/
|
|
16
|
-
clearAllTimeouts(): void;
|
|
17
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* A class that provides a wrapper around the global setTimeout and clearTimeout functions.
|
|
3
|
+
*/
|
|
4
|
+
export declare class TimeoutAPI {
|
|
5
|
+
private timeout_handlers;
|
|
6
|
+
/**
|
|
7
|
+
* Calls a function after a specified delay, in milliseconds.
|
|
8
|
+
* @param callback The function to call after the delay.
|
|
9
|
+
* @param delay The number of milliseconds to wait before calling the function.
|
|
10
|
+
* @returns A handle that can be used to clear the timeout with clearTimeout.
|
|
11
|
+
*/
|
|
12
|
+
setTimeout(callback: () => void, delay: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Clears all timeouts that have been created with setTimeout.
|
|
15
|
+
*/
|
|
16
|
+
clearAllTimeouts(): void;
|
|
17
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { JsPsych } from "../../JsPsych";
|
|
2
|
-
import { HardwareAPI } from "./HardwareAPI";
|
|
3
|
-
import { KeyboardListenerAPI } from "./KeyboardListenerAPI";
|
|
4
|
-
import { MediaAPI } from "./MediaAPI";
|
|
5
|
-
import { SimulationAPI } from "./SimulationAPI";
|
|
6
|
-
import { TimeoutAPI } from "./TimeoutAPI";
|
|
7
|
-
export declare function createJointPluginAPIObject(jsPsych: JsPsych): KeyboardListenerAPI & TimeoutAPI & MediaAPI & HardwareAPI & SimulationAPI;
|
|
8
|
-
export
|
|
1
|
+
import { JsPsych } from "../../JsPsych";
|
|
2
|
+
import { HardwareAPI } from "./HardwareAPI";
|
|
3
|
+
import { KeyboardListenerAPI } from "./KeyboardListenerAPI";
|
|
4
|
+
import { MediaAPI } from "./MediaAPI";
|
|
5
|
+
import { SimulationAPI } from "./SimulationAPI";
|
|
6
|
+
import { TimeoutAPI } from "./TimeoutAPI";
|
|
7
|
+
export declare function createJointPluginAPIObject(jsPsych: JsPsych): KeyboardListenerAPI & TimeoutAPI & MediaAPI & HardwareAPI & SimulationAPI;
|
|
8
|
+
export type PluginAPI = ReturnType<typeof createJointPluginAPIObject>;
|