brown-ccv / honeycomb

Starter repo for jspsych/react/electron behavioral tasks
https://brown-ccv.github.io/honeycomb-docs/
MIT License
9 stars 8 forks source link

Add `getLastTrialDataUtility` function from GearShift #499

Closed RobertGemmaJr closed 2 months ago

RobertGemmaJr commented 3 months ago
/**
 * Retrieves the data object from the last trial in JsPsych
 * @param {JsPsych} jsPsych jsPsych instance being used to run the task
 * @returns {Object}
 */
export function getLastTrialData(jsPsych) {
  const dataCollection = jsPsych.data.getLastTrialData();
  return dataCollection.trials[0];
}