mot
motorway
npm i motorway
mot

motorway

Flow Control for NodeJS

by Adam Laycock

0.2.2 (see all)License:MITTypeScript:Built-InCategories:Express Control Flow
npm i motorway
Readme

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

Downloads/wk

2

GitHub Stars

0

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.2.2
latest
4yrs ago
No tutorials found
Add a tutorial