Motorway
Asyncronous Flow control for NodeJS Applications
Usage
Require Motorway and create a new instance:
Motorway = motorway =
motorway.addJunction(name[, runAfter])
Adds a junction identified by name which runs after all the junctions in runAfter finish
motorway.addAction(junction, function)
Adds function as an action for junction
Actions must end with this.rejoin()
so that motorway knows when to flag the action as complete.
motorway.loadJunction(modulePath)
Load a junction from modulePath. Your junction file should look like this:
moduleexports = name: 'configure' runAfter: 'init' actions: { this }
motorway.dropJunction(name)
Drops the junction name so that it wont run.
motorway.replaceJunction(oldJunctionName, newJunctionName)
Creates a new junction call newJUnctionName with the runAfter details from oldJunctionName. It then calls dropJunction for oldJunctionName
Useful for replacing the listen
junction with a test
junction in your tests
motorway.start(name)
Starts your motoway at the junction name