Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An easy chainable API for dependency based asynchronous flow.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
node_modules/prelude-ls
src
README.md
package.json

README.md

GraphFlow

This library allows you to set up asynchronous flow in a javascript program without thinking much about what is running in parralel.

Example (in LiveScript)

flow!
  .add \one, (cb) ->
    cb null, 1

  .add \two, (cb) ->
    cb null, 1

  .add \added, <[one two]>, (cb) ->
    cb null, @one + @two

  .error (e) ->
    throw e

  .done (v) ->
    console.log 'The answer is: ', v.added

  .run!

By putting it in a Depencency Graph (link needed), when run is called, all functions are executed as soon as possible. When all dependencies for a node have been fulfilled, the graph executes that node (in parrallel). When a node has nothing to point to it is considered an end of the graph and the value is collected for the done callback.

By just declaring dependencies for the callbacks you request scope where needed and the graph figures it out.

Todo

  • Unit test ALL THE THINGS!
  • Generate a GraphViz (link needed) DOT graph with a method on Graph.
  • Maybe expose the graph to flow(), to be able to create a DOT graph out of defined flows.
Something went wrong with that request. Please try again.