code: function mixin_emitter(c) { //todo change to "mixin_emitter"
    if (c.add_listener)
      return;
    var listeners = {};
    var bubbler = null;
    c.add_listener = function (name, callback) {
      if (!listeners[name])
        listeners[name] = [];
      listeners[name].push(callback);
    }
    c.remove_listeners = function (name) {
      listeners[name] = [];
    }
    c.emit = function (name, data) {
      if (bubbler)
        bubbler.emit(name, data);
      else if (listeners[name])
        for (var i = 0; i < listeners[name].length; i++)
          listeners[name][i](c, data);
    }
    c.bubble_listener = function(p){
      bubbler = p;
    }
  }
docs: component mixin