|
| 1 | +import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; |
| 2 | +declare const info: { |
| 3 | + readonly name: "survey"; |
| 4 | + readonly parameters: { |
| 5 | + /** |
| 6 | + * A SurveyJS survey model defined in JSON. |
| 7 | + * See: https://surveyjs.io/form-library/documentation/design-survey/create-a-simple-survey#define-a-static-survey-model-in-json |
| 8 | + */ |
| 9 | + readonly survey_json: { |
| 10 | + readonly type: ParameterType.STRING; |
| 11 | + readonly default: "{}"; |
| 12 | + readonly pretty_name: "Survey JSON"; |
| 13 | + }; |
| 14 | + /** |
| 15 | + * A SurveyJS survey model defined as a function. The function receives an empty SurveyJS survey object as an argument. |
| 16 | + * See: https://surveyjs.io/form-library/documentation/design-survey/create-a-simple-survey#create-or-change-a-survey-model-dynamically |
| 17 | + */ |
| 18 | + readonly survey_function: { |
| 19 | + readonly type: ParameterType.FUNCTION; |
| 20 | + readonly default: any; |
| 21 | + readonly pretty_name: "Survey function"; |
| 22 | + }; |
| 23 | + /** |
| 24 | + * A function that can be used to validate responses. This function is called whenever the SurveyJS onValidateQuestion event occurs. |
| 25 | + * See: https://surveyjs.io/form-library/documentation/data-validation#implement-custom-client-side-validation |
| 26 | + */ |
| 27 | + readonly validation_function: { |
| 28 | + readonly type: ParameterType.FUNCTION; |
| 29 | + readonly default: any; |
| 30 | + readonly pretty_name: "Validation function"; |
| 31 | + }; |
| 32 | + }; |
| 33 | +}; |
| 34 | +type Info = typeof info; |
| 35 | +/** |
| 36 | + * **survey** |
| 37 | + * |
| 38 | + * jsPsych plugin for presenting complex questionnaires using the SurveyJS library |
| 39 | + * |
| 40 | + * @author Becky Gilbert |
| 41 | + * @see {@link https://www.jspsych.org/plugins/survey/ survey plugin documentation on jspsych.org} |
| 42 | + */ |
| 43 | +declare class SurveyPlugin implements JsPsychPlugin<Info> { |
| 44 | + private jsPsych; |
| 45 | + static info: { |
| 46 | + readonly name: "survey"; |
| 47 | + readonly parameters: { |
| 48 | + /** |
| 49 | + * A SurveyJS survey model defined in JSON. |
| 50 | + * See: https://surveyjs.io/form-library/documentation/design-survey/create-a-simple-survey#define-a-static-survey-model-in-json |
| 51 | + */ |
| 52 | + readonly survey_json: { |
| 53 | + readonly type: ParameterType.STRING; |
| 54 | + readonly default: "{}"; |
| 55 | + readonly pretty_name: "Survey JSON"; |
| 56 | + }; |
| 57 | + /** |
| 58 | + * A SurveyJS survey model defined as a function. The function receives an empty SurveyJS survey object as an argument. |
| 59 | + * See: https://surveyjs.io/form-library/documentation/design-survey/create-a-simple-survey#create-or-change-a-survey-model-dynamically |
| 60 | + */ |
| 61 | + readonly survey_function: { |
| 62 | + readonly type: ParameterType.FUNCTION; |
| 63 | + readonly default: any; |
| 64 | + readonly pretty_name: "Survey function"; |
| 65 | + }; |
| 66 | + /** |
| 67 | + * A function that can be used to validate responses. This function is called whenever the SurveyJS onValidateQuestion event occurs. |
| 68 | + * See: https://surveyjs.io/form-library/documentation/data-validation#implement-custom-client-side-validation |
| 69 | + */ |
| 70 | + readonly validation_function: { |
| 71 | + readonly type: ParameterType.FUNCTION; |
| 72 | + readonly default: any; |
| 73 | + readonly pretty_name: "Validation function"; |
| 74 | + }; |
| 75 | + }; |
| 76 | + }; |
| 77 | + private survey; |
| 78 | + private start_time; |
| 79 | + constructor(jsPsych: JsPsych); |
| 80 | + applyStyles(survey: any): void; |
| 81 | + trial(display_element: HTMLElement, trial: TrialType<Info>): void; |
| 82 | +} |
| 83 | +export default SurveyPlugin; |
0 commit comments