title: Implementing EventTarget on custom objects
body: <p>Using Closure Library, you can give any object the ability to dispatch events extending <a href="http://closure-library.googlecode.com/svn/docs/class_goog_events_EventTarget.html" rel="nofollow"><code>goog.events.EventTarget</code></a>. Is this currently possible using Dart libraries? </p>
  
  <p>I imagine it would look like this:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>#import('dart:html');
  
  class Foo implements EventTarget {
    Events get on() {
      // ???
    }
  }
  
  main() {
    Foo foo = new Foo();
  
    // Subscribe to the event.
    foo.on['bar'].add((Event event) =&gt; print('bar!'));
  
    // Dispatch the event.
    foo.on['bar'].dispatch(new Event('bar'));
  }
  </code></pre>
  
  <p>Am I on the right track?</p>
  
  <p><strong>Edit</strong> Thanks to Lars Tackmann, a working draft is here: <a href="http://try.dartlang.org/s/f6wk" rel="nofollow">http://try.dartlang.org/s/f6wk</a></p>