Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brianc committed Dec 21, 2010
1 parent f0f85f9 commit d91045e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/index.js
Expand Up @@ -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 {
Expand All @@ -26,6 +30,7 @@ var executeAction = function(action, callback) {
}
}
}
//optional setup parameter
if(action.setup) {
action.setup(function(result) {
doAction(action, result)
Expand Down

0 comments on commit d91045e

Please sign in to comment.