code: function getEmitter(config) {
        function Emitter(n) {
          n = n || this;
          n.__events = n.__events || {};
          n.__once = n.__once || {};
        }
  
        Emitter.prototype.on = function(name, fn) {
          fn = fn || Function();
          this.__events[name] = (this.__events[name] || [])
          this.__events[name].push(fn);
        }
  
        Emitter.prototype.once = function(name, fn) {
          fn = fn || Function();
          this.__once[name] = (this.__once[name] || []);
          this.__once[name].push(fn);
        }
  
        Emitter.prototype.off = function(name, fn) {
          var i;
  
          fn = fn || Function();
          i = (this.__events[name] || []).indexOf(fn);
          if (~i) this.__events[name].splice(i, 1);
  
          i = (this.__once[name] || []).indexOf(fn);
          if (~i) this.__once[name].splice(i, 1);
        }
  
        Emitter.prototype.emit = function(name) {
          var args = [].slice.call(arguments),
              es = (this.__events[name] || []).slice(),
              i, self = this;
  
          args.shift();
          es.push.apply(es, this.__once[name] || []);
  
          for (i = 0; i < es.length; i++) {
            es[i].apply(self, args);
          }
  
          this.__once[name] = [];
        }
  
        Emitter.prototype.emitCtx = function(name, ctx) {
          var args = [].slice.call(arguments),
              es = (this.__events[name] || []).slice(),
              i, self = this;
  
          args.shift(); args.shift();
          es.push.apply(es, this.__once[name] || []);
  
          for (i = 0; i < es.length; i++) {
            es[i].apply(ctx, args);
          }
  
          this.__once[name] = [];
        }
  
        return Emitter;
      }
docs: emitter =================================================================