Comparing version 0.1.1 to 0.1.2
@@ -29,3 +29,19 @@ //============================== | ||
function Sequencer (steps, ifError) { | ||
function Sequencer (steps, opt1, opt2) { | ||
var ifError; | ||
var context; | ||
if (typeof opt1 === 'function') { | ||
ifError = opt1; | ||
} else if (typeof opt2 === 'function') { | ||
ifError = opt2; | ||
} | ||
if (typeof opt1 === 'object') { | ||
context = opt1; | ||
} else if (typeof opt2 === 'object') { | ||
context = opt2; | ||
} | ||
this.context = context || null; | ||
this.ifError = ifError; | ||
@@ -67,3 +83,3 @@ this.numSteps = steps.length; | ||
applyArgs.push(nextArg); | ||
this.ifError.apply(null, applyArgs); | ||
this.ifError.apply(this.context, applyArgs); | ||
} | ||
@@ -80,4 +96,4 @@ return; | ||
this.stepIndex += 1; | ||
thisStep.apply(null, this.passArgs); | ||
thisStep.apply(this.context, this.passArgs); | ||
}; | ||
{ | ||
"name": "ordination", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"title": "Ordination", | ||
@@ -5,0 +5,0 @@ "description": "Organize and regulate the flow of execution.", |
7390
10
194