mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
First pass at allowing functions as variables
This commit is contained in:
parent
c8cb4204d1
commit
30df65e95b
@ -55,13 +55,19 @@
|
|||||||
var sim_trial_complete = false;
|
var sim_trial_complete = false;
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial, part) {
|
plugin.trial = function(display_element, block, trial, part) {
|
||||||
|
|
||||||
|
// if any trial variables are functions
|
||||||
|
// this evaluates the function and replaces
|
||||||
|
// it with the output of the function
|
||||||
|
trial = jsPsych.normalizeTrialVariables(trial);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case 1:
|
case 1:
|
||||||
sim_trial_complete = false;
|
sim_trial_complete = false;
|
||||||
// show the images
|
// show the images
|
||||||
if (!trial.is_html) {
|
if (!trial.is_html) {
|
||||||
display_element.append($('<img>', {
|
display_element.append($('<img>', {
|
||||||
"src": trial.a_path,
|
"src": normed_trial.a_path,
|
||||||
"id": 'jspsych_sim_stim'
|
"id": 'jspsych_sim_stim'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -231,4 +237,4 @@
|
|||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
})();
|
})();
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
Loading…
Reference in New Issue
Block a user