  var log = require('./log');

  /**
   * Interface: eventhandling
   */
  var methods = {
    /**
     * Method: addEventListener
     *
     * Install an event handler for the given event name
     */
    addEventListener: function (eventName, handler) {
      if (typeof(eventName) !== 'string') {
        throw new Error('Argument eventName should be a string');
      }
      if (typeof(handler) !== 'function') {
        throw new Error('Argument handler should be a function');
      }
      log('[Eventhandling] Adding event listener', eventName);
      this._validateEvent(eventName);
      this._handlers[eventName].push(handler);
    },

    /**
     * Method: removeEventListener
     *
     * Remove a previously installed event handler
     */
    removeEventListener: function (eventName, handler) {
      this._validateEvent(eventName);
      var hl = this._handlers[eventName].length;
      for (var i=0;i<hl;i++) {
        if (this._handlers[eventName][i] === handler) {
          this._handlers[eventName].splice(i, 1);
          return;
        }
      }
    },

    _emit: function (eventName) {
      this._validateEvent(eventName);
      var args = Array.prototype.slice.call(arguments, 1);
      this._handlers[eventName].slice().forEach(function (handler) {
        handler.apply(this, args);
      });
    },

    _validateEvent: function (eventName) {
      if (! (eventName in this._handlers)) {
        throw new Error("Unknown event: " + eventName);
      }
    },

    _delegateEvent: function (eventName, target) {
      target.on(eventName, function (event) {
        this._emit(eventName, event);
      }.bind(this));
    },

    _addEvent: function (eventName) {
      this._handlers[eventName] = [];
    }
  };

  /**
   * Method: eventhandling.on
   *
   * Alias for <addEventListener>
   **/
  methods.on = methods.addEventListener;

  /**
   * Method: eventhandling.off
   *
   * Alias for <removeEventListener>
   **/
  methods.off = methods.removeEventListener;


  /**
   * Function: eventHandling
   *
   * Mixes event handling functionality into an object.
   *
   * The first parameter is always the object to be extended.
   * All remaining parameter are expected to be strings, interpreted as valid event
   * names.
   *
   * Example:
   *   (start code)
   *   var MyConstructor = function () {
   *     eventHandling(this, 'connected', 'disconnected');
   *
   *     this._emit('connected');
   *     this._emit('disconnected');
   *     // This would throw an exception:
   *     // this._emit('something-else');
   *   };
   *
   *   var myObject = new MyConstructor();
   *   myObject.on('connected', function () { console.log('connected'); });
   *   myObject.on('disconnected', function () { console.log('disconnected'); });
   *   // This would throw an exception as well:
   *   // myObject.on('something-else', function () {});
   *   (end code)
   */
 module.exports = function (object) {
    var eventNames = Array.prototype.slice.call(arguments, 1);
    for (var key in methods) {
      object[key] = methods[key];
    }
    object._handlers = {};
    eventNames.forEach(function (eventName) {
      object._addEvent(eventName);
    });
  };

@@ -39,17 +39,18 @@
   * 
-I
+@i
 nterface
 : ev
@@ -45,31 +45,17 @@
 nterface
-: eventhandling
+k
 %0A   */%0A 
@@ -83,47 +83,8 @@
 /**%0A
-     * Method: addEventListener%0A     *%0A
     
@@ -602,50 +602,8 @@
 /**%0A
-     * Method: removeEventListener%0A     *%0A
     
@@ -1657,43 +1657,8 @@
 /**%0A
-   * Method: eventhandling.on%0A   *%0A
    *
@@ -1668,17 +1668,18 @@
 ias for 
-%3C
+%60%60
 addEvent
@@ -1678,33 +1678,34 @@
 addEventListener
-%3E
+%60%60
 %0A   **/%0A  method
@@ -1748,44 +1748,8 @@
 /**%0A
-   * Method: eventhandling.off%0A   *%0A
    *
@@ -1759,17 +1759,18 @@
 ias for 
-%3C
+%60%60
 removeEv
@@ -1784,9 +1784,10 @@
 ener
-%3E
+%60%60
 %0A   
@@ -1847,42 +1847,8 @@
 /**%0A
-   * Function: eventHandling%0A   *%0A
    *
@@ -2076,43 +2076,21 @@
   * 
-E
+@e
 xample
-:
 %0A   *
-   (start code)%0A   *  
  var
@@ -2124,18 +2124,16 @@
 ) %7B%0A   *
-  
    event
@@ -2181,34 +2181,32 @@
 ');%0A   *%0A   *   
- 
- 
 this._emit('conn
@@ -2218,18 +2218,16 @@
 ');%0A   *
-  
    this.
@@ -2256,18 +2256,16 @@
 %0A   *   
- 
- 
 // This 
@@ -2294,18 +2294,16 @@
 on:%0A   *
-  
    // th
@@ -2334,18 +2334,16 @@
 ');%0A   *
-  
  %7D;%0A   *
@@ -2347,18 +2347,16 @@
   *%0A   *
-  
  var myO
@@ -2384,26 +2384,24 @@
 ctor();%0A   *
-  
  myObject.on
@@ -2462,18 +2462,16 @@
 %7D);%0A   *
-  
  myObjec
@@ -2538,26 +2538,24 @@
 '); %7D);%0A   *
-  
  // This wou
@@ -2585,26 +2585,24 @@
 s well:%0A   *
-  
  // myObject
@@ -2644,26 +2644,8 @@
 %7D);%0A
-   *   (end code)%0A
    *

Switch eventhandling to JSDoc