mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use RED.nodes.filterLinks in pref to RED.nodes.eachLink
This commit is contained in:
parent
cf8fe16b09
commit
9c104faff3
@ -813,6 +813,9 @@ RED.nodes = (function() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (filter.sourcePort && link.sourcePort !== filter.sourcePort) {
|
||||
continue;
|
||||
}
|
||||
result.push(link);
|
||||
}
|
||||
return result;
|
||||
|
@ -114,11 +114,7 @@ RED.editor = (function() {
|
||||
}
|
||||
}
|
||||
if (node.inputs === 0) {
|
||||
RED.nodes.eachLink(function(l) {
|
||||
if (l.target === node) {
|
||||
removedLinks.push(l);
|
||||
}
|
||||
});
|
||||
removedLinks.concat(RED.nodes.filterLinks({target:node}));
|
||||
}
|
||||
for (var l=0;l<removedLinks.length;l++) {
|
||||
RED.nodes.removeLink(removedLinks[l]);
|
||||
|
@ -929,10 +929,7 @@ RED.view = (function() {
|
||||
dst = mousedown_node;
|
||||
src_port = portIndex;
|
||||
}
|
||||
var existingLink = false;
|
||||
RED.nodes.eachLink(function(d) {
|
||||
existingLink = existingLink || (d.source === src && d.target === dst && d.sourcePort == src_port);
|
||||
});
|
||||
var existingLink = RED.nodes.filterLinks({source:src,target:dst,sourcePort: src_port}).length !== 0;
|
||||
if (!existingLink) {
|
||||
var link = {source: src, sourcePort:src_port, target: dst};
|
||||
RED.nodes.addLink(link);
|
||||
|
Loading…
Reference in New Issue
Block a user