/**
 * @author Gilles Coomans <gilles.coomans@gmail.com>
 */
 
if(typeof define !== 'function')
	var define = require('amdefine')(module);

define(["require"], function deepEmitterDefine(require)
{
	return function(deep)
	{
		var Event  = deep.Event = function(type){
			this.type = type;
		};
		var Emitter = deep.Emitter = function(){
			var listeners = {};
			this.emit = function(event){
				var list = listeners[event];
				if(!list)
					return;
				for(var i = 0, len = list.length; i < len; ++i)
					list[i](new Event(event));
			};
			this.on = function(event, callback){
				listeners[event] = listeners[event] || [];
				callback._deep_listener_index_ = listeners[event].length;
				listeners[event].push(callback);
			};
			this.remove = function(event, callback){
				var list = listeners[event];
				if(!list)
					return;
				list.splice(callback._deep_listener_index_,1);
			};
		};
		return Emitter;
	};
});
@@ -58,16 +58,17 @@
  */%0A %0Aif
+ 
 (typeof 
@@ -89,18 +89,23 @@
 nction')
-%0A%09
+ %7B%0A    
 var defi
@@ -138,16 +138,17 @@
 odule);%0A
+%7D
 %0Adefine(
@@ -265,18 +265,56 @@
 ion(type
-)%7B
+, datas)%7B%0A%09%09%09this.datas = datas %7C%7C null;
 %0A%09%09%09this
@@ -422,21 +422,27 @@
 unction(
-event
+type, datas
 )%7B%0A%09%09%09%09v
@@ -453,37 +453,36 @@
 ist = listeners%5B
-event
+type
 %5D;%0A%09%09%09%09if(!list)
@@ -570,21 +570,27 @@
 w Event(
-event
+type, datas
 ));%0A%09%09%09%7D
@@ -605,37 +605,36 @@
 s.on = function(
-event
+type
 , callback)%7B%0A%09%09%09
@@ -644,21 +644,20 @@
 steners%5B
-event
+type
 %5D = list
@@ -662,21 +662,20 @@
 steners%5B
-event
+type
 %5D %7C%7C %5B%5D;
@@ -722,21 +722,20 @@
 steners%5B
-event
+type
 %5D.length
@@ -750,21 +750,20 @@
 steners%5B
-event
+type
 %5D.push(c
@@ -804,21 +804,20 @@
 unction(
-event
+type
 , callba
@@ -850,13 +850,12 @@
 ers%5B
-event
+type
 %5D;%0A%09

add datas object as args. (emitter)