In Node.js, does listening to an EventEmitter, create a reference to it?
<p>If I have some code like this:</p>

<pre><code>const EventEmitter = require('events');

class Bot extends EventEmitter {
  sendMessage() {
    // do something
    this.emit('messageSent', 'user123');
  }
}

class Controller {
  loadBot() {
    const bot = new Bot();
    bot.on('messageSent', userId =&gt; {
      // do something
    });
  }
}
</code></pre>

<p>Would the <code>bot</code> object created inside <code>loadBot</code> be destroyed immediately? or perhaps later via garbage collection? </p>

<p>Or would the instance of <code>Controller</code> hold a reference to it so that <code>bot</code> would never be destroyed until the <code>Controller</code> instance was destroyed?</p>