define(["exports"],function(_exports){function getCallbacks(obj,name){var allCallbacks;if(obj)return(allCallbacks=obj._callbacks)||(obj._callbacks=allCallbacks={}),(obj=allCallbacks[name])||(allCallbacks[name]=[],obj=allCallbacks[name]),obj;throw new Error("obj cannot be null!")}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;_exports.default={on:function(obj,eventName,fn){getCallbacks(obj,eventName).push(fn)},off:function(obj,eventName,fn){obj=getCallbacks(obj,eventName),eventName=obj.indexOf(fn);-1!==eventName&&obj.splice(eventName,1)},trigger:function(obj,eventName){for(var eventArgs=[{type:eventName}].concat(babelHelpers.toConsumableArray(arguments[2]||[])),callbacks=getCallbacks(obj,eventName).slice(0),i=0,length=callbacks.length;i<length;i++)try{callbacks[i].apply(obj,eventArgs)}catch(err){console.error("Error during callback execution for event '"+eventName+"':",err)}}}});