jspsych 8.1.0 → 8.2.1

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.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
  /**
@@ -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 randomization_randomWords: typeof randomWords;
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
  /**
@@ -928,6 +907,7 @@ declare class JsPsych {
928
907
  data: JsPsychData;
929
908
  pluginAPI: PluginAPI;
930
909
  version(): string;
910
+ private citation;
931
911
  /** Options */
932
912
  private options;
933
913
  /** Experiment timeline */
@@ -983,6 +963,15 @@ declare class JsPsych {
983
963
  resumeExperiment(): void;
984
964
  getSafeModeStatus(): boolean;
985
965
  getTimeline(): TimelineArray;
966
+ /**
967
+ * Prints out a string containing citations for the jsPsych library and all input plugins/extensions in the specified format.
968
+ * If called without input, prints citation for jsPsych library.
969
+ *
970
+ * @param plugins The plugins/extensions to generate citations for. Always prints the citation for the jsPsych library at the top.
971
+ * @param format The desired output citation format. Currently supports "apa" and "bibtex".
972
+ * @returns String containing citations separated with newline character.
973
+ */
974
+ getCitations(plugins?: Array<Class<JsPsychPlugin<any>> | Class<JsPsychExtension>>, format?: "apa" | "bibtex"): string;
986
975
  get extensions(): Record<string, JsPsychExtension>;
987
976
  private prepareDom;
988
977
  private finishTrialPromise;
@@ -1000,4 +989,4 @@ declare class JsPsych {
1000
989
  */
1001
990
  declare function initJsPsych(options?: any): JsPsych;
1002
991
 
1003
- export { DataCollection, JsPsych, JsPsychExtension, JsPsychExtensionInfo, JsPsychPlugin, ParameterType, PluginInfo, TrialType, initJsPsych };
992
+ export { DataCollection, JsPsych, type JsPsychExtension, type JsPsychExtensionInfo, type JsPsychPlugin, ParameterType, type PluginInfo, type TrialType, initJsPsych };