jspsych 8.0.3 → 8.2.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/README.md +1 -1
- package/dist/index.browser.js +1350 -400
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.min.js +7 -6
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +251 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -40
- package/dist/index.js +251 -115
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ExtensionManager.spec.ts +1 -1
- package/src/JsPsych.ts +46 -0
- package/src/modules/extensions.ts +1 -0
- package/src/modules/plugins.ts +1 -0
- package/src/modules/randomization.ts +1 -1
- package/src/timeline/Timeline.spec.ts +105 -5
- package/src/timeline/Timeline.ts +12 -9
- package/src/timeline/Trial.spec.ts +15 -1
- package/src/timeline/Trial.ts +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ interface PluginInfo {
|
|
|
64
64
|
version?: string;
|
|
65
65
|
parameters: ParameterInfos;
|
|
66
66
|
data?: ParameterInfos;
|
|
67
|
+
citations?: Record<string, string> | string;
|
|
67
68
|
}
|
|
68
69
|
interface JsPsychPlugin<I extends PluginInfo> {
|
|
69
70
|
trial(display_element: HTMLElement, trial: TrialType<I>, on_load?: () => void): void | Promise<TrialResult | void>;
|
|
@@ -75,6 +76,7 @@ interface JsPsychExtensionInfo {
|
|
|
75
76
|
name: string;
|
|
76
77
|
version?: string;
|
|
77
78
|
data?: ParameterInfos;
|
|
79
|
+
citations?: Record<string, string> | string;
|
|
78
80
|
}
|
|
79
81
|
interface JsPsychExtension {
|
|
80
82
|
/**
|
|
@@ -204,7 +206,7 @@ declare class Timeline extends TimelineNode {
|
|
|
204
206
|
* If the timeline is running or paused, aborts the timeline after the current trial has completed
|
|
205
207
|
*/
|
|
206
208
|
abort(): void;
|
|
207
|
-
private
|
|
209
|
+
private instantiateChildNode;
|
|
208
210
|
private currentTimelineVariables;
|
|
209
211
|
private setCurrentTimelineVariablesByIndex;
|
|
210
212
|
/**
|
|
@@ -790,39 +792,23 @@ type RandomWordsResult<T extends RandomWordsOptions> = T extends {
|
|
|
790
792
|
*/
|
|
791
793
|
declare function randomWords<T extends RandomWordsOptions>(opts: T): RandomWordsResult<T>;
|
|
792
794
|
|
|
793
|
-
declare const randomization_setSeed: typeof setSeed;
|
|
794
|
-
declare const randomization_repeat: typeof repeat;
|
|
795
|
-
declare const randomization_shuffle: typeof shuffle;
|
|
796
|
-
declare const randomization_shuffleNoRepeats: typeof shuffleNoRepeats;
|
|
797
|
-
declare const randomization_shuffleAlternateGroups: typeof shuffleAlternateGroups;
|
|
798
|
-
declare const randomization_sampleWithoutReplacement: typeof sampleWithoutReplacement;
|
|
799
|
-
declare const randomization_sampleWithReplacement: typeof sampleWithReplacement;
|
|
800
795
|
declare const randomization_factorial: typeof factorial;
|
|
801
796
|
declare const randomization_randomID: typeof randomID;
|
|
802
797
|
declare const randomization_randomInt: typeof randomInt;
|
|
798
|
+
declare const randomization_randomWords: typeof randomWords;
|
|
799
|
+
declare const randomization_repeat: typeof repeat;
|
|
803
800
|
declare const randomization_sampleBernoulli: typeof sampleBernoulli;
|
|
804
|
-
declare const randomization_sampleNormal: typeof sampleNormal;
|
|
805
|
-
declare const randomization_sampleExponential: typeof sampleExponential;
|
|
806
801
|
declare const randomization_sampleExGaussian: typeof sampleExGaussian;
|
|
807
|
-
declare const
|
|
802
|
+
declare const randomization_sampleExponential: typeof sampleExponential;
|
|
803
|
+
declare const randomization_sampleNormal: typeof sampleNormal;
|
|
804
|
+
declare const randomization_sampleWithReplacement: typeof sampleWithReplacement;
|
|
805
|
+
declare const randomization_sampleWithoutReplacement: typeof sampleWithoutReplacement;
|
|
806
|
+
declare const randomization_setSeed: typeof setSeed;
|
|
807
|
+
declare const randomization_shuffle: typeof shuffle;
|
|
808
|
+
declare const randomization_shuffleAlternateGroups: typeof shuffleAlternateGroups;
|
|
809
|
+
declare const randomization_shuffleNoRepeats: typeof shuffleNoRepeats;
|
|
808
810
|
declare namespace randomization {
|
|
809
|
-
export {
|
|
810
|
-
randomization_setSeed as setSeed,
|
|
811
|
-
randomization_repeat as repeat,
|
|
812
|
-
randomization_shuffle as shuffle,
|
|
813
|
-
randomization_shuffleNoRepeats as shuffleNoRepeats,
|
|
814
|
-
randomization_shuffleAlternateGroups as shuffleAlternateGroups,
|
|
815
|
-
randomization_sampleWithoutReplacement as sampleWithoutReplacement,
|
|
816
|
-
randomization_sampleWithReplacement as sampleWithReplacement,
|
|
817
|
-
randomization_factorial as factorial,
|
|
818
|
-
randomization_randomID as randomID,
|
|
819
|
-
randomization_randomInt as randomInt,
|
|
820
|
-
randomization_sampleBernoulli as sampleBernoulli,
|
|
821
|
-
randomization_sampleNormal as sampleNormal,
|
|
822
|
-
randomization_sampleExponential as sampleExponential,
|
|
823
|
-
randomization_sampleExGaussian as sampleExGaussian,
|
|
824
|
-
randomization_randomWords as randomWords,
|
|
825
|
-
};
|
|
811
|
+
export { randomization_factorial as factorial, randomization_randomID as randomID, randomization_randomInt as randomInt, randomization_randomWords as randomWords, randomization_repeat as repeat, randomization_sampleBernoulli as sampleBernoulli, randomization_sampleExGaussian as sampleExGaussian, randomization_sampleExponential as sampleExponential, randomization_sampleNormal as sampleNormal, randomization_sampleWithReplacement as sampleWithReplacement, randomization_sampleWithoutReplacement as sampleWithoutReplacement, randomization_setSeed as setSeed, randomization_shuffle as shuffle, randomization_shuffleAlternateGroups as shuffleAlternateGroups, randomization_shuffleNoRepeats as shuffleNoRepeats };
|
|
826
812
|
}
|
|
827
813
|
|
|
828
814
|
interface turkInformation {
|
|
@@ -865,13 +851,10 @@ declare function turkInfo(): turkInformation;
|
|
|
865
851
|
*/
|
|
866
852
|
declare function submitToTurk(data: any): void;
|
|
867
853
|
|
|
868
|
-
declare const turk_turkInfo: typeof turkInfo;
|
|
869
854
|
declare const turk_submitToTurk: typeof submitToTurk;
|
|
855
|
+
declare const turk_turkInfo: typeof turkInfo;
|
|
870
856
|
declare namespace turk {
|
|
871
|
-
export {
|
|
872
|
-
turk_turkInfo as turkInfo,
|
|
873
|
-
turk_submitToTurk as submitToTurk,
|
|
874
|
-
};
|
|
857
|
+
export { turk_submitToTurk as submitToTurk, turk_turkInfo as turkInfo };
|
|
875
858
|
}
|
|
876
859
|
|
|
877
860
|
/**
|
|
@@ -888,15 +871,11 @@ declare function deepCopy(obj: any): any;
|
|
|
888
871
|
*/
|
|
889
872
|
declare function deepMerge(obj1: any, obj2: any): any;
|
|
890
873
|
|
|
891
|
-
declare const utils_unique: typeof unique;
|
|
892
874
|
declare const utils_deepCopy: typeof deepCopy;
|
|
893
875
|
declare const utils_deepMerge: typeof deepMerge;
|
|
876
|
+
declare const utils_unique: typeof unique;
|
|
894
877
|
declare namespace utils {
|
|
895
|
-
export {
|
|
896
|
-
utils_unique as unique,
|
|
897
|
-
utils_deepCopy as deepCopy,
|
|
898
|
-
utils_deepMerge as deepMerge,
|
|
899
|
-
};
|
|
878
|
+
export { utils_deepCopy as deepCopy, utils_deepMerge as deepMerge, utils_unique as unique };
|
|
900
879
|
}
|
|
901
880
|
|
|
902
881
|
/**
|
|
@@ -983,6 +962,15 @@ declare class JsPsych {
|
|
|
983
962
|
resumeExperiment(): void;
|
|
984
963
|
getSafeModeStatus(): boolean;
|
|
985
964
|
getTimeline(): TimelineArray;
|
|
965
|
+
/**
|
|
966
|
+
* Prints out a string containing citations for the jsPsych library and all input plugins/extensions in the specified format.
|
|
967
|
+
* If called without input, prints citation for jsPsych library.
|
|
968
|
+
*
|
|
969
|
+
* @param plugins The plugins/extensions to generate citations for. Always prints the citation for the jsPsych library at the top.
|
|
970
|
+
* @param format The desired output citation format. Currently supports "apa" and "bibtex".
|
|
971
|
+
* @returns String containing citations separated with newline character.
|
|
972
|
+
*/
|
|
973
|
+
getCitations(plugins?: Array<Class<JsPsychPlugin<any>> | Class<JsPsychExtension>>, format?: "apa" | "bibtex"): string;
|
|
986
974
|
get extensions(): Record<string, JsPsychExtension>;
|
|
987
975
|
private prepareDom;
|
|
988
976
|
private finishTrialPromise;
|
|
@@ -1000,4 +988,4 @@ declare class JsPsych {
|
|
|
1000
988
|
*/
|
|
1001
989
|
declare function initJsPsych(options?: any): JsPsych;
|
|
1002
990
|
|
|
1003
|
-
export { DataCollection, JsPsych, JsPsychExtension, JsPsychExtensionInfo, JsPsychPlugin, ParameterType, PluginInfo, TrialType, initJsPsych };
|
|
991
|
+
export { DataCollection, JsPsych, type JsPsychExtension, type JsPsychExtensionInfo, type JsPsychPlugin, ParameterType, type PluginInfo, type TrialType, initJsPsych };
|