Add RED.nodes.getNodeLinks to help node-link lookup

This commit is contained in:
Nick O'Leary 2022-01-03 23:27:25 +00:00
parent 43651135f3
commit 24b52f09df
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 11 additions and 1 deletions

View File

@ -2551,7 +2551,17 @@ RED.nodes = (function() {
addLink: addLink,
removeLink: removeLink,
getNodeLinks: function(id, portType) {
if (nodeLinks[id]) {
if (portType === 1) {
// Return cloned arrays so they can be safely modified by caller
return [].concat(nodeLinks[id].in)
} else {
return [].concat(nodeLinks[id].out)
}
}
return [];
},
addWorkspace: addWorkspace,
removeWorkspace: removeWorkspace,
getWorkspaceOrder: function() { return workspacesOrder },