vflow

0.2.18 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i vflow

Weekly Downloads

0

Version

0.2.18

License

MIT

Last publish

Collaborators

  • nicevincentma