Skip to content

Commit

Permalink
feat: add getCurrentTrialData form gearshift into utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
YUUU23 committed Jul 6, 2024
1 parent 890de74 commit e5cee24
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,12 @@ export function getSeconds(ms) {
export function getTimeString(ms) {
return `${getMinute(ms)}:${getSeconds(ms).toString().padStart(2, "0")}`;
}

/**
* Retrieves the data object from the current trial in JsPsych
* @param {JsPsych} jsPsych jsPsych instance being used to run the task
* @returns
*/
export function getCurrentTrialData(jsPsych) {
return jsPsych.getCurrentTrial().data;
}

0 comments on commit e5cee24

Please sign in to comment.