diff options
| -rw-r--r-- | lib/serpentity/node_collection.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/serpentity/node_collection.js b/lib/serpentity/node_collection.js index 7c2c627..deeb26d 100644 --- a/lib/serpentity/node_collection.js +++ b/lib/serpentity/node_collection.js @@ -59,18 +59,20 @@ const NodeCollection = class NodeCollection extends Events { remove(entity) { let foundIndex = -1; + let foundNode = null; const found = this.nodes.some((node, i) => { if (node.entity === entity) { foundIndex = i; + foundNode = node; return true; } }); if (found) { this.nodes.splice(foundIndex, 1); - this.emit('nodeRemoved', { node }); + this.emit('nodeRemoved', { foundNode }); } return found; |