flow-if-else-component

0.2.5 • Public • Published

Flow if-else component

The component evaluates an expression to true or false.

To use the component, in your NodeJS project, get it from npm registry

npm i flow-if-else-component --save

Use the component as below

// require the component
const Component = require('flow-if-else-component');

// create instance of the component
const component = new Component();

Provide the expression

// this can be any javascript expression, '[].length', 'a==1', ' ' and more
component.getProperty('Expression').data = 'q=1'; 

That's all, now listen in for port emit events

component.getPort('True').onEmit(function() {
  // the expression evaluated to true
});

component.getPort('False').onEmit(function() {
  // the expression evaluated to false
});

Execute the component

// add the component to a graph before executing it
const Graph = require('flow-platform-sdk').Graph;
new Graph("graph-1").addComponent(component);

component.execute();

Conclusion

That's all required to use Flow's If-else component.

Readme

Keywords

Package Sidebar

Install

npm i flow-if-else-component

Weekly Downloads

2

Version

0.2.5

License

Apache-2.0

Unpacked Size

19.7 kB

Total Files

9

Last publish

Collaborators

  • hackerbayadmin