'use strict';
+const Events = require('events');
+
/*
* Node Collections contain nodes, in order to keep the lists of nodes
* that belong to each type.
* instances of that class.
*/
-const NodeCollection = class NodeCollection {
+const NodeCollection = class NodeCollection extends Events {
constructor(config) {
}
this.nodes.push(node);
+ this.emit('nodeAdded', { node });
return true;
}
if (found) {
this.nodes.splice(foundIndex, 1);
+ this.emit('nodeRemoved', { node });
}
return found;