-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import StartRecordPlugin from "./start"; | ||
import StopRecordPlugin from "./stop"; | ||
import TrialRecordExtension from "./trial"; | ||
|
||
export default { TrialRecordExtension }; | ||
export default { TrialRecordExtension, StartRecordPlugin, StopRecordPlugin }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { JsPsych, JsPsychPlugin, TrialType } from "jspsych"; | ||
import Recorder from "./recorder"; | ||
|
||
const info = <const>{ name: "start-record-plugin", parameters: {} }; | ||
type Info = typeof info; | ||
|
||
/** | ||
* | ||
*/ | ||
export default class StartRecordPlugin implements JsPsychPlugin<Info> { | ||
public static readonly info = info; | ||
recorder: Recorder; | ||
/** @param jsPsych */ | ||
constructor(private jsPsych: JsPsych) { | ||
this.recorder = new Recorder(this.jsPsych); | ||
} | ||
|
||
/** | ||
* @param _display_element | ||
* @param _trial | ||
*/ | ||
trial( | ||
_display_element: HTMLElement, | ||
_trial: TrialType<Info>, | ||
): void | Promise<any> { | ||
this.recorder.start(); | ||
setTimeout(() => this.jsPsych.finishTrial(), 1000); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { JsPsych, JsPsychPlugin, TrialType } from "jspsych"; | ||
import Recorder from "./recorder"; | ||
|
||
const info = <const>{ name: "stop-record-plugin", parameters: {} }; | ||
type Info = typeof info; | ||
|
||
/** | ||
* | ||
*/ | ||
export default class StopRecordPlugin implements JsPsychPlugin<Info> { | ||
public static readonly info = info; | ||
private recorder: Recorder; | ||
/** @param jsPsych */ | ||
constructor(private jsPsych: JsPsych) { | ||
this.recorder = new Recorder(this.jsPsych); | ||
} | ||
|
||
/** | ||
* @param _display_element | ||
* @param _trial | ||
*/ | ||
trial( | ||
_display_element: HTMLElement, | ||
_trial: TrialType<Info>, | ||
): void | Promise<any> { | ||
setTimeout(() => this.recorder.stop(), 1000); | ||
} | ||
} |