define([],function(){"use strict";functiongetCallbacks(obj,name){if(!obj)thrownewError("obj cannot be null!");obj._callbacks=obj._callbacks||{};varlist=obj._callbacks[name];returnlist||(obj._callbacks[name]=[],list=obj._callbacks[name]),list}return{on:function(obj,eventName,fn){varlist=getCallbacks(obj,eventName);list.push(fn)},off:function(obj,eventName,fn){varlist=getCallbacks(obj,eventName),i=list.indexOf(fn);i!==-1&&list.splice(i,1)},trigger:function(obj,eventName){vareventObject={type:eventName},eventArgs=[];eventArgs.push(eventObject);for(varadditionalArgs=arguments[2]||[],i=0,length=additionalArgs.length;i<length;i++)eventArgs.push(additionalArgs[i]);varcallbacks=getCallbacks(obj,eventName).slice(0);callbacks.forEach(function(c){c.apply(obj,eventArgs)})}}});