text: var EventManager = new (function(){var eventPile = {};var addEventListener = function(eventId, callback){if (!eventPile[eventId]){eventPile[eventId] = [];}eventPile[eventId].push(callback);};var emit = function(eventId, data){if (eventPile[eventId]){for (var i = 0; i < eventPile[eventId].length; ++i){(function(){var index = i;setTimeout(function(){eventPile[eventId][index](data);}, 0);})();}}};this.makeEventAware = function(element){if (typeof element === 'function'){element.prototype.addEventListener = addEventListener;element.prototype.emit = emit;}else{element.addEventListener = addEventListener;element.emit = emit;}}})();
  