Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using noflo.asCallback with a graph instance #583

Merged
merged 3 commits into from
Nov 24, 2017

Conversation

bergie
Copy link
Member

@bergie bergie commented Nov 24, 2017

Right now, the noflo.asCallback embedding API only works with registered components or subgraphs.

To make it more flexible (as requested in #582), this PR adds a way to call it with a noflo.Graph instance as well.

So, you can either:

const wrapped = noflo.asCallback('myproject/Component');
wrapped(inputs, (err, outputs) => {});

or:

noflo.graph.loadFBP(`SOME FBP DATA`, (err, graph) => {
  const wrapped = noflo.asCallback(graph);
  wrapped(inputs, (err, outputs) => {});
});

Obviously the NoFlo graph can be constructed in whatever way... by loading JSON or FBP, or by using the graph API directly. However, it must have exported ports for this to work.

@bergie bergie merged commit f3d951d into master Nov 24, 2017
@bergie bergie deleted the ascallback_arbitrary branch November 24, 2017 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant