jQuery plugin for Event Driven Architecture?

Posted by leeand00 on Stack Overflow See other posts from Stack Overflow or by leeand00
Published on 2010-06-03T15:22:59Z Indexed on 2010/06/03 20:54 UTC
Read the original article Hit count: 748

Are there any Event Driven Architecture jQuery plugins?

Step 1: Subscribing

alt text
The subscribers subscribe to the event handler in the middle, and pass in a callback method, as well as the name of the event they are listening for...

i.e. The two green subscribers will be listening for p0 events. And the blue subscriber will be listening for p1 events.


Step 2: The p0 event is fired by another component to the Event Handler

alt text

  1. A p0 event is fired to the Event Handler
  2. The event handler notifies it's subscribers of the event, calling the callback methods they specified when they subscribed in Step 1: Subscribing.

Note that the blue subscriber is not notified because it was not listening for p0 events.


Step 3: The p1 event is fired a component to the Event Handler

alt text

The p1 event is fired by another component

Just as before except that now the blue subscriber receives the event through its callback and the other two green subscribers do not receive the event.

Images by leeand00, on Flickr

I can't seem to find one, but my guess is that they just call it something else in Javascript/jquery

Also is there a name for this pattern? Because it isn't just a basic publisher/subscriber, it has to be called something else I would think.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jquery-plugins