Blueprint-Graph-in-Javascript
Create nodes, join the graph, wait for the result. Just like Blueprint. Asynchronous for everythings.
What's this for?
Help you write Javascript code like Unreal blueprint.
Uhh, may be you need a beautiful UI.
All source codes useful were in src/index.ts
.
And src/example.ts
is an example for use, basic_lib.ts
is an example for writting an library.
How to use it?
First of all, create a graph.
let ctx = ;
Then create some nodes with initial value.
let node1 = ;let node2 = ;let nodemmul = ;let show = ;
Tell graph the connections between nodes.
node1;node2;nodemmul;
Finally run the graph.
ctx;
And you get the result:16
.
The code above is equivalent to:
console;
How to create your own node?
A custom node is like this:
You can get data by port name, if the data is not prepared, your node will wait until the data arrived.
Also, write some wrappers to help you remember port names.
These codes show how to use for loop in graph.
;;fornode.linkTofornode.out.index, testnode, "exec_signal";
Then we will get:
hello0
hello1
hello2
hello3
hello4
When will nodes run?
- When graph begin.
- When someone push data to a completed node.
- When some remain data is found when it completed.
Why do you make things complicated?
Uhh, I don't know. Just for fun.