0.2.18 • Published 7 years ago
vflow v0.2.18
Inspired by flow based programming. Now support browser only.
const g = vflow();
// == Nodes ==
const appStart = g.addNode({
id: 'Start'
})
g.addNode({
id: 'Plus',
inPorts: ['a', 'b'],
process: ({state, send}, portName) => {
const { a, b } = state;
send(a + b);
}
})
g.addNode({
id: 'MapTo5',
component: 'core/Mapper',
data: {
map: () => 5
}
})
// == Network ==
g.loadGraph({
"nodes": {
"Start": {
"pos": "72,36,72,72"
},
"Plus": {
"pos": "432,72,72,72",
"data": {
"a": 5
}
},
"MapTo5": {
"pos": "288,-216,72,72"
}
},
"edges": [
"Start:out -> MapTo5:in",
"MapTo5:out -> Plus:b"
]
})
// == Bootstrap ==
appStart.send()
Dev
npm run start
Build (webpack production)
npm run build