1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

Merge pull request #345 from thewhodidthis/bf#339--trial-handler

data/TrialHandler: allow for calling next() like PsychoPy
This commit is contained in:
Alain Pitiot 2021-05-25 11:04:17 +02:00 committed by GitHub
commit fbd30ab2db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,17 @@ export class TrialHandler extends PsychObject
}
/**
* Helps go through each trial in the sequence one by one, mirrors PsychoPy.
*/
next() {
const trialIterator = this[Symbol.iterator]();
const { value } = trialIterator.next();
return value;
}
/**
* Iterator over the trial sequence.
*