appflow
Tools for generating graphs for application flow. So you can make a diagram of your application flow with dotviz, and then actually use it in your application.
Introduction
You write graphs (in dot format) that represent connectioning parts of an application.
digraph app {
titleScreen -> mainMenu
mainMenu -> singlePlayer
mainMenu -> multiPlayer
mainMenu -> settings
singlePlayer -> game
game -> quit
quit -> mainMenu
}
You then instantiate the graph, providing implementations for nodes to link it to your application code.
You can then listen to changes in the graph.
const appflow = require('./lib/appflow')
const Graph = appFlow.Graph
const Race = appFlow.node.Race
const src = `
digraph app {
titleScreen -> mainMenu
mainMenu -> singlePlayer
mainMenu -> multiPlayer
mainMenu -> settings
singlePlayer -> game
game -> quit
quit -> mainMenu
}
`
const app = Graph.fromDot(src)
const nodes = {
mainMenu: Race()
}
const startingNode = app.nodes.titleScreen
app.run(startingNode)
app.on('change',() => console.log(app.active)
How do these nodes work?
Check out the literate specs about the nodes for more information.
run tests
gulp test
watch directory for changes
gulp watch