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:
commit
fbd30ab2db
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user