/***/
// [browser-emitter-js] Emitter.js
(function(win) {

  typeof module != 'undefined' && (module.exports = Emitter);
  win.Emitter = Emitter;

  function Emitter() {
    this._events = {};
  }

  var EmitterProtos = {
    on: on,
    off: off,
    emit: emit,
    fire: fire
  };
  for( var i in EmitterProtos)
    Emitter.prototype[i] = EmitterProtos[i];

  function on() {

    var self = this;
    var args = Array.prototype.slice.call(arguments), type = args.shift();
    !Array.isArray(this._events[type]) && (this._events[type] = []);
    this._events[type].push(args[0]); // TODO more options

    return this;

  }

  function off() {

    var self = this;
    var args = Array.prototype.slice.call(arguments), type = args.shift();
    !Array.isArray(this._events[type]) && (this._events[type] = []);

    var splice_pos = 0;
    while(splice_pos < this._events[type].length)
      typeof args[0] != 'function' || args[0] === fn ? (function() {
        self._events[type].splice(splice_pos, 1);
      })(): splice_pos++;

    this._events[type].length == 0 && delete this._events[type];
    return this;

  }

  function emit() {

    var self = this;
    var args = Array.prototype.slice.call(arguments), type = args.shift();
    !Array.isArray(this._events[type]) && (this._events[type] = []);

    if(this._type || this._args)
      throw new Error('[Emitter.js] emit event under unexpected condition.');

    this._type = type, this._args = args;
    self.fire();

    return this;

  }

  function fire() {
    var self = this;
    var type = self._type, args = self._args;
    delete self._type, delete self._args, (function(handlers) {
      Array.isArray(handlers) && handlers.forEach(function(fn) {
        fn.apply(self, args);
      });
    })(self._events[type]);
  }

})(window);

@@ -249,34 +249,60 @@
     
-emit: emit,%0A    fire: fire
+once: once,%0A    emit: emit,%0A    listeners: listeners
 %0A  %7D
@@ -361,16 +361,22 @@
 pe%5Bi%5D = 
+_wrap(
 EmitterP
@@ -383,16 +383,17 @@
 rotos%5Bi%5D
+)
 ;%0A%0A  fun
@@ -405,213 +405,75 @@
  on(
-) %7B%0A%0A    var self = this;%0A    var args = Array.prototype.slice.call(arguments), type = args.shift();%0A    !Array.isArray(this._events%5Btype%5D) && (this._events%5Btype%5D = %5B%5D);%0A    this._events%5Btype%5D.push(
+type, args) %7B%0A    this._events%5Btype%5D.push(%7B%0A      fn: 
 args%5B0%5D
+%0A    %7D
 ); /
@@ -492,17 +492,16 @@
 options%0A
-%0A
     retu
@@ -501,33 +501,32 @@
    return this;%0A
-%0A
   %7D%0A%0A  function 
@@ -530,189 +530,193 @@
 on o
-ff(
+nce(type, args
 ) %7B%0A
-%0A
     
-var self = this;%0A    var args = Array.prototype.slice.call(arguments), type = args.shift();%0A    !Array.isArray(this._events%5Btype%5D) && (this._events%5Btype%5D = %5B%5D);%0A%0A    var
+this._events%5Btype%5D.push(%7B%0A      fn: args%5B0%5D,%0A      once: true%0A    %7D); // TODO more options%0A    return this;%0A  %7D%0A%0A  function off(type, args) %7B%0A%0A    var self = this,
  spl
@@ -777,16 +777,67 @@
 .length)
+ %7B%0A      var stat = this._events%5Btype%5D%5Bsplice_pos%5D;
 %0A      t
@@ -879,16 +879,21 @@
 %5B0%5D === 
+stat.
 fn ? (fu
@@ -978,16 +978,22 @@
 e_pos++;
+%0A    %7D
 %0A%0A    th
@@ -1090,16 +1090,26 @@
 on emit(
+type, args
 ) %7B%0A%0A   
@@ -1128,507 +1128,495 @@
 this
-;%0A    var args = Array.prototype.slice.call(arguments), type = args.shift();%0A    !Array.isArray(this._events%5Btype%5D) && (this._events%5Btype%5D = %5B%5D);%0A%0A    if(this._type %7C%7C 
+, splice_pos = 0;%0A    while(splice_pos %3C this._events%5Btype%5D.length) %7B%0A      var stat = this._events%5Btype%5D%5Bsplice_pos%5D;%0A      stat.fn.apply(
 this
-._
+, 
 args)
-%0A      throw new Error('%5BEmitter.js%5D emit event under unexpected condition.');%0A%0A    this._type = type, this._args = args;%0A    self.fire();%0A%0A    return this;%0A%0A  %7D%0A%0A  function fire() %7B%0A    var self = this;%0A    var type = self._type, args = self._args;%0A    delete self._type, delete self._args, (function(handlers) %7B
+, stat.once ? (function() %7B%0A        self._events%5Btype%5D.splice(splice_pos, 1);%0A      %7D)(): splice_pos++;%0A    %7D%0A%0A    return this;%0A%0A  %7D%0A%0A  function listeners(type) %7B%0A    return this._events%5Btype%5D.length;%0A  %7D%0A%0A  function _wrap(fn) %7B%0A    return function() %7B%0A      var args = Array.prototype.slice.call(arguments), type = args.shift();
 %0A      
+!
 Arra
@@ -1629,74 +1629,89 @@
 ray(
-handlers) && handlers.forEach(function(fn) %7B%0A        fn.apply(self
+this._events%5Btype%5D) && (this._events%5Btype%5D = %5B%5D);%0A      return fn.call(this, type
 , ar
@@ -1723,40 +1723,9 @@
     
- 
- %7D);%0A    %7D)(self._events%5Btype%5D)
+%7D
 ;%0A  

add once, listeners, and simplify logic