motorway
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.2 • Public • Published

    Motorway

    Build Status Coverage Status Dependency Status npm version

    Asyncronous Flow control for NodeJS Applications

    Usage

    Require Motorway and create a new instance:

    Motorway = require('motorway')
    motorway = new 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:

    module.exports = {
      name: 'configure',
      runAfter: ['init'],
      actions: [
        function(){
          this.rejoin()
        }
      ]
    }

    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

    Install

    npm i motorway

    DownloadsWeekly Downloads

    6

    Version

    0.2.2

    License

    MIT

    Last publish

    Collaborators

    • arcath