From d91045e33a6260d73f2f121184b1ffe28da016d4 Mon Sep 17 00:00:00 2001 From: brianc Date: Tue, 21 Dec 2010 00:16:42 -0600 Subject: [PATCH] comments --- lib/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 071f551..0cb8fec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,19 +3,23 @@ var executeAction = function(action, callback) { var doAction = function(action, context) { //no more repeats to execute if(action.repeat > i++) { + //support for optional context overloads + //there might be a better way to do this if(context) { var cb = function() { doAction(action, context) } action.run(context, cb) - } else { + } else { //no context var cb = function() { doAction(action) } action.run(cb) } - } else { + } else { //no more actions to repeat, do teardown if teardown if(action.teardown) { + //support for optional context overloads + //there might be a better way to do this if(context) { action.teardown(context, callback) } else { @@ -26,6 +30,7 @@ var executeAction = function(action, callback) { } } } + //optional setup parameter if(action.setup) { action.setup(function(result) { doAction(action, result)