JavaScript Event Factory

by Jason on August 5, 2012

I have started a new project this weekend on Github that I’m calling the JavaScript Event Factory.

I am mostly doing this so I can understand how to build messaging systems in JavaScript and it’s also my attempt to understand the convoluted Event-based architectures.

Currently this project is very much experimental, but as it grows the idea is that it will encapsulate the most common messaging patterns under a single namespace and follow the proper design patterns.

JavaScript Event Factory currently supports:

I may expand this in the future to add more patterns, but currently these appear to be the most widely used.

The thing I like most about my solution, so far, is that it does not rely at all on any DOM Events. Perhaps it’s naivety, but I saw no real need to utilize DOM Events, except for the useful Event.stopPropogation and Event.preventDefault. However, I have implemented my own version of this for when it’s necessary.

This approach allows me to create a DOM-independent messaging system. So this would allow simple objects to communicate with other objects without having to be tied to a particular node.

As always, your feedback would be highly appreciated.

Github Link