mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Making it clear when on_trial_start and on_trial_finish are executed. (#3118)
* Making it clear when on_trial_start and on_trial_finish are executed.
* Update docs/overview/events.md
Co-authored-by: bjoluc <mail@bjoluc.de>
* Update docs/overview/events.md
Co-authored-by: bjoluc <mail@bjoluc.de>
---------
Co-authored-by: bjoluc <mail@bjoluc.de>
(rebased-with-history from commit b78dcc6830
)
This commit is contained in:
commit
30b5587973
@ -142,7 +142,7 @@ var procedure = {
|
||||
|
||||
## on_trial_finish
|
||||
|
||||
The `on_trial_finish` callback can be declared in the `initJsPsych` method. The callback will trigger at the end of every trial in the experiment. If you want a callback to trigger only for the end of certain trials, use the [`on_finish`](#onfinishtrial) callback on the trial object. The callback function will be passed a single argument, containing the data object from the trial.
|
||||
The `on_trial_finish` callback can be declared in the `initJsPsych` method. The callback will trigger at the end of every trial in the experiment, after the trial object's [`on_finish`](#onfinishtrial) callback has been run. The callback function will be passed a single argument, containing the data object from the trial. If you want a callback to trigger only for the end of certain trials, use the [`on_finish`](#onfinishtrial) callback on the trial object instead.
|
||||
|
||||
```javascript
|
||||
initJsPsych({
|
||||
@ -157,7 +157,7 @@ initJsPsych({
|
||||
|
||||
## on_trial_start
|
||||
|
||||
The `on_trial_start` callback can be declared in the `initJsPsych` method. The callback will trigger at the start of every trial in the experiment. The function receives a single argument: a modifiable copy of the trial object that will be used to run the next trial. Changes can be made to this object to alter the parameters of the upcoming trial.
|
||||
The `on_trial_start` callback can be declared in the `initJsPsych` method. The callback will trigger at the start of every trial in the experiment, before the trial-specific `on_start` callback is executed. The function receives a single argument: a modifiable copy of the trial object that will be used to run the next trial. Changes can be made to this object to alter the parameters of the upcoming trial.
|
||||
|
||||
```javascript
|
||||
var current_score = 0; // a variable that is updated throughout the experiment to keep track of the current score.
|
||||
|
Loading…
Reference in New Issue
Block a user