Editing Plugin Files
How trial parameters work in
The entry point of a trial using the
core plugin is under
The two arguments are
display_element, the html element for trial and
trial, the object containing all the trial's parameters.
Next, you'll see something like the following. This takes the fields from
trial (or a default value) and adds them as fields of the class. This it is accessible whenever needed as
Then in the
showRecall method, these values are used to do the trial.
For instance, rendering buttons gets the following arguments. Here,
stimulus is one item from the array of
Here is the corresponding file.
So, you have access to all the fields as before. For instance
coreInstance.randomize is the same as
stimulus is the current object in the
This is passed further down to the container which can access the stimulus parameters the same way.
Adding new parameters
Take the following hypothetical trial, where
foobar are new paremeters we want to add.
bar, will be accessible as
stimulus.bar in the
showRecall method and wherever
stimulus is passed.
foobar, you can add a line like
this.foobar = setParameter(trial.foobar, "default string", "string");. Then
this.foobar, will be accessible anywhere in