title: Node.js - Best method for emitting events from modules
body: <p>I've been playing around with the <code>EventEmitter</code>, but I'm confused about how exactly I should implement it from a module. I've seen a few different ways, and they all seem to work. Here are a few I've seen:</p>
  <p>From <a href="https://gist.github.com/833401" rel="nofollow noreferrer">here</a>:</p>
  <pre><code>var Twitter = function() {...};
  
  Twitter.prototype = new events.EventEmitter;
  </code></pre>
  <p>But then in <a href="http://visionmedia.github.com/masteringnode/book.html" rel="nofollow noreferrer">&quot;Mastering Node&quot;</a> they do it this way:</p>
  <pre><code>function Dog(name) {
    this.name = name;
    EventEmitter.call(this);
  }
  
  Dog.prototype.__proto__ = EventEmitter.prototype;
  </code></pre>
  <p>(why would you need to .call it?)</p>
  <p>And then in my own code I tried yet another way:</p>
  <pre><code>function Class() {}
  
  Class.prototype = EventEmitter.prototype;
  </code></pre>
  <p>They're all just inheriting from EventEmitter in their own way, so wouldn't the simplest solution be the best?</p>