By using LiteGraph.js First I added input and output , then I tried in the next example To get input data (String) and showing in alert , but it allows give a null Or undefined Data !! I don't understand why!?
(function(global) {
var LiteGraph = global.LiteGraph;
function Variable(){
this.addInput("Set");
this.addOutput("Get");
}
Variable.shape = LiteGraph.ROUND_SHAPE;
Variable.title = "Variable";
Variable.desc = "set value of variable";
// Event
Variable.prototype.onExecute = function() {
this.setOutputData(0,'output');
};
Variable.prototype.onConnectInput= function(){
var k =this.getInputData(0,true);
alert('Input '+k)
};
//On OUTPUT is connected
Variable.prototype.onConnectOutput = function(){
// this.setOutputData(0,'Data');
var x = this.getInputData(0,true);
alert('Output '+x);
}
LiteGraph.registerNodeType("variable/var", Variable);
})(this);
I hope someone will help and Thanks ಠ‿ಠ