title: How do I create a custom event class in Javascript?
body: <p>How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data.</p>
  <p>I don't want to use third-party libraries like YUI or jQuery to do it. My goal is to be able to send a event that looks like this:</p>
  <pre><code>document.addEventListener(&quot;customEvent&quot;, eventHandler, false);
  
  function eventHandler(e){
      alert(e.para1);
  }
  
  document.dispatchEvent(new CustomEvent(&quot;customEvent&quot;, para1, para2));
  </code></pre>
  <p>Please no third-party library solutions.</p>