export default class EventManager {
	constructor() {
		this.listener = {};
	}

	addEventListener(eventType, listener) {
		if(!this.listener[eventType])
			this.listener[eventType] = [];

		this.listener[eventType].push(listener);
	}

	dispatch(eventType, event) {
		if(!this.listener[eventType])
			return;

		this.listener[eventType].forEach(listener => listener(event));
	}
}

const EVENTS = {
	START_ROOM: 'start_room',
	JOIN_ROOM:  'join_room',
	START_GAME: 'start_game',
};

export { EventManager, EVENTS };

@@ -1,237 +1,847 @@
-export default class EventManager %7B%0A%09constructor() %7B%0A%09%09this.listener = %7B%7D;%0A%09%7D%0A%0A%09addEventListener(eventType, listener) %7B%0A%09%09if(!this.listener%5BeventType%5D)%0A%09%09%09this.listener%5BeventType%5D = %5B%5D;%0A%0A%09%09this.listener%5BeventType%5D.push(listener);%0A%09%7D%0A
+/**%0A * This class handles the event listeners and%0A * provide a function to dispatch a event%0A */%0Aexport default class EventManager %7B%0A%0A%09/**%0A%09 * Default constructor%0A%09 */%0A%09constructor() %7B%0A%09%09this.listener = %7B%7D;%0A%09%7D%0A%0A%09/**%0A%09 * This function registers a listener for an event%0A%09 *%0A%09 * Sample:%0A%09 *   CustleCrush.EventManager.addEventListener(EVENTS.START_GAME, handler);%0A%09 *%0A%09 * @param  %7Bstring%7D    eventType  The event type%0A%09 * @param  %7Bfunction%7D  listener   The listener%0A%09 */%0A%09addEventListener(eventType, listener) %7B%0A%09%09if(!this.listener%5BeventType%5D)%0A%09%09%09this.listener%5BeventType%5D = %5B%5D;%0A%0A%09%09this.listener%5BeventType%5D.push(listener);%0A%09%7D%0A%0A%09/**%0A%09 * This function dispatches a event%0A%09 *%0A%09 * Sample:%0A%09 *   CustleCrush.EventManager.dispatch(EVENTS.START_GAME, %7B%7D);%0A%09 *%0A%09 * @param  %7Bstring%7D  eventType  The event type%0A%09 * @param  %7Bobject%7D  event      The event%0A%09 */
 %0A%09di
@@ -982,16 +982,152 @@
 ;%0A%09%7D%0A%7D%0A%0A
+/**%0A * This constant represents the event types.%0A *%0A * To import it:%0A *   import %7BEVENTS%7D from 'EventManager';%0A *%0A * @type %7BObject%7D%0A */%0A
 const EV

Add some comments to the EventManager