mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-13 09:08:13 +00:00
formatting
This commit is contained in:
parent
59d2e0b451
commit
e6092d685f
@ -2,31 +2,31 @@
|
|||||||
* Example plugin template
|
* Example plugin template
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jsPsych["PLUGIN-NAME"] = (function(){
|
jsPsych["PLUGIN-NAME"] = (function() {
|
||||||
|
|
||||||
var plugin = {};
|
var plugin = {};
|
||||||
|
|
||||||
plugin.trial = function(display_element, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// set default values for parameters
|
// set default values for parameters
|
||||||
trial.parameter = trial.parameter || 'default value';
|
trial.parameter = trial.parameter || 'default value';
|
||||||
|
|
||||||
// allow variables as functions
|
// allow variables as functions
|
||||||
// this allows any trial variable to be specified as a function
|
// this allows any trial variable to be specified as a function
|
||||||
// that will be evaluated when the trial runs. this allows users
|
// that will be evaluated when the trial runs. this allows users
|
||||||
// to dynamically adjust the contents of a trial as a result
|
// to dynamically adjust the contents of a trial as a result
|
||||||
// of other trials, among other uses. you can leave this out,
|
// of other trials, among other uses. you can leave this out,
|
||||||
// but in general it should be included
|
// but in general it should be included
|
||||||
trial = jsPsych.evaluateFunctionParameters(trial);
|
trial = jsPsych.evaluateFunctionParameters(trial);
|
||||||
|
|
||||||
// data saving
|
// data saving
|
||||||
var trial_data = {
|
var trial_data = {
|
||||||
parameter_name: 'parameter value'
|
parameter_name: 'parameter value'
|
||||||
};
|
};
|
||||||
|
|
||||||
// end trial
|
// end trial
|
||||||
jsPsych.finishTrial(trial_data);
|
jsPsych.finishTrial(trial_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user