Created
November 22, 2012 23:16
-
-
Save fruchtose/4133280 to your computer and use it in GitHub Desktop.
everymodule#step method implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
step: function (name) { | |
var steps = this._steps | |
, sequence = this._currSeq; | |
if (!sequence) | |
throw new Error("You can only declare a step after declaring a route alias via `get(...)` or `post(...)`."); | |
sequence.orderedStepNames.push(name); | |
this._currentStep = | |
steps[name] || (steps[name] = new Step(name, this)); | |
// For configuring what the actual business | |
// logic is: | |
// fb.step('fetchOAuthUser') generates the method | |
// fb.fetchOAuthUser whose logic can be configured like | |
// fb.fetchOAuthUser( function (...) { | |
// // Business logic goes here | |
// } ); | |
this.configurable(name, | |
'STEP FN [' + name + '] function encapsulating the logic for the step `' + name + '`.'); | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment