Skip to content

Commit

Permalink
Finished up initial metadata example draft - to be reviewed
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhang03 committed Jun 13, 2024
1 parent 505be4b commit 9e4947d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/plugin-html-keyboard-response/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

import { version } from "../package.json";

const info = <const>{
name: "html-keyboard-response",
parameters: {
Expand Down Expand Up @@ -52,6 +54,20 @@ const info = <const>{
default: true,
},
},
data: {
/** Indicates which key the participant pressed. */
response: {
type: ParameterType.STRING,
},
/** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */
rt: {
type: ParameterType.INT,
},
/** The HTML content that was displayed on the screen. */
stimulus: {
type: ParameterType.HTML_STRING, // do we want this as a string
},
},
};

type Info = typeof info;
Expand All @@ -69,6 +85,10 @@ class HtmlKeyboardResponsePlugin implements JsPsychPlugin<Info> {

constructor(private jsPsych: JsPsych) {}

version() {
return version;
}

trial(display_element: HTMLElement, trial: TrialType<Info>) {
var new_html = '<div id="jspsych-html-keyboard-response-stimulus">' + trial.stimulus + "</div>";

Expand Down

0 comments on commit 9e4947d

Please sign in to comment.