From 946f1aeea0cefeea8d77448c0cbddd62460e316a Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Tue, 17 Jul 2012 18:13:52 -0400 Subject: [PATCH] bug fixes for callback methods in previous commit --- jspsych.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jspsych.js b/jspsych.js index b987e97f..b55aa679 100755 --- a/jspsych.js +++ b/jspsych.js @@ -25,10 +25,6 @@ var initialized = false; // target DOM element var DOM_target; - // trial start callback method - var on_trial_start; - // trial finish callback method - var on_trial_finish; // // public methods @@ -36,7 +32,7 @@ core.init = function($this, options){ var defaults = { - 'on_trial_start': function(){ return undefined; } + 'on_trial_start': function(){ return undefined; }, 'on_trial_finish': function() { return undefined; } } // import options @@ -142,7 +138,7 @@ done: nextBlock, - num_trials: trials_list.length + num_trials: trial_list.length } return block; @@ -156,13 +152,13 @@ function do_trial(block, trial) { // call on_trial_start() - on_trial_start(); + opts.on_trial_start(); // execute trial method jsPsych[trial.type]["trial"].call(this, DOM_target, block, trial, 1); // call on_trial_finish() - on_trial_finish(); + opts.on_trial_finish(); } return core;