# Faster custom events

**URL:** <https://forum.kirupa.com/t/faster-custom-events/239035>\
**Category:** Uncategorized\
**Created:** [September 18, 2007, 8:57am UTC](https://forum.kirupa.com/t/faster-custom-events/239035 "2007-09-18T08:57:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aquilonian](https://avatars.discourse-cdn.com/v4/letter/a/97f17d/32.png) [@Aquilonian](https://forum.kirupa.com/u/Aquilonian)\
**Post date:** [September 18, 2007, 8:57am UTC](https://forum.kirupa.com/t/faster-custom-events/239035/1 "2007-09-18T08:57:01Z")

</div>

Hi kirupians  
I think i have found something i want to share with you  
I was making my own event objects using IEventDispatcher and, as always, i was thinking ‘do i really need that?’ and decided to make my own event system, cutting everything i dont need, like that bubble thing  
So i made it, its a bit diferent but not much, instead of  
this.addEventListener(“alarm”, listenerFunction)  
for example, if the event type is alarm, it goes:  
this.addLAlarm(listenerFunction)  
so it goes tht for each event you have his own function to add and remove listeners, so that its not needed to make a internal search for the type of the event  
Also, for each event it have an array of internal listeners  
And also, when is time to dispatch instead of figuring out what the parameters the event needs, creating an event object,put the parameters on it, dispatch it to each listener function that will get the parameters out of the object, it put the parameters directly on the listener functions  
So this way you have to know exactly what parameters each listeners functions will need, and what events yourclass will have  
And the results… 7x faster
