rete
rete copied to clipboard
Code plugin example
Hi I am wanting to look at making use of the Code plugin for rete but am a bit lost as to its implementation. I have looked on codepen and cannot see an example there for it (you have many other excellent examples, just not for the Code plugin).
Is there a code example (preferably with Vue) for implementing this plugin? I have had a look at the website documentation but don't quite understand how / why / where the following is used
const sourceCode = await CodePlugin.generate(engine, editor.toJSON());
and what the purpose of the following code is (it doesn't seem to be used anywhere):
code(node, inputs, add) { // 'node' parameter as in worker()
// 'inputs' contains variable names
add('console.log("hello!")') // add a line of code
add('num', node.data.num); // add a variable with the value "node.data.num"
}
Thanks for such an excellent and useful library, I find myself using it often (but the code plugin has be stumped LOL)
https://codepen.io/hatead1/pen/yLLWxdY, but "add" function with two param does not work
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.