MaxTrautwein / TAR-Weiterentwicklung-IoT-Tor

GNU General Public License v3.0
0 stars 1 forks source link

(Request) A Node should know wich input ports are connected to something #2

Closed MaxTrautwein closed 2 years ago

MaxTrautwein commented 2 years ago

Currently there is no way to check for the number of connected inputs from a node. This should be easily accessible.

MaxTrautwein commented 2 years ago

Used Inputs can be determined using the following setup:

var tid = this.id;
var input_Usage = Array(4).fill(undefined);
RED.nodes.eachNode(function(n){
    if (n.wires === undefined) return;
    for(let i = 0 ; i<n.wires.length;i++){
        if (n.wires[i][0] == tid){
            let tp = n.full_wires[i][0]["target_port"];
            input_Usage[tp] = n.id
        }
    }
});

Sample output:

[ 'c4ded3954c88a635', undefined, undefined, 'c4ded3954c88a635' ]