title: Custom event library for JavaScript. Are there any? Recommendations?
body: <p>I'm looking for a JavaScript library that will allow me to use custom events that I can subscribe to and fire. I also need the event name/scope to work similarly to that of topics in a message queue, where you can subscribe to a namespace and get all events for that namespace.</p>
  
  <p>For example,</p>
  
  <pre><code>var myCustomEventHandler = new CustomEventHandler();
  
  myCustomEventHandler.bind('my.event', function(data) { console.log('Event 1'); });
  myCustomEventHandler.bind('my.other.event', function(data) { console.log('Event 2'); });
  myCustomEventHandler.bind('my.*', function(data) { console.log('Event 3'); });
  
  myCustomEventHandler.trigger('my.event');
  // Logs "Event 1" and "Event 3"
  
  myCustomEventHandler.trigger('my.other.event');
  // Logs "Event 2" and "Event 3"
  
  myCustomEventHandler.trigger('my.something.else');
  // Logs "Event 3"
  </code></pre>
  
  <p>I could write something custom, but I'd prefer to use an open source library if there is one.</p>
  
  <p>Cheers.</p>