rete icon indicating copy to clipboard operation
rete copied to clipboard

Code plugin example

Open JasonWeiseUnreal opened this issue 5 years ago • 1 comments

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)

JasonWeiseUnreal avatar Nov 25 '19 04:11 JasonWeiseUnreal

https://codepen.io/hatead1/pen/yLLWxdY, but "add" function with two param does not work

Hatead1 avatar Nov 26 '19 08:11 Hatead1

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.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]