Class Index | File Index

Classes


Class Event.Broker

Event.Broker Description: Allows listeners to subscribe to event types, and remain blissfully unaware of the available publishers of those events Requires prototype.js Usage: You'll usually want to create a copy of the Broker object by mixing it in with one of your own classes as follows: Object.extend( your_obj, Event.Broker ) Publishers register the event types they send with a call to your_broker_object.registerEventsPublisher and "unregister" via your_broker_object.unregisterEventsPublisher Nothing changes for the event listeners, except they call their listen() method once for each event type (passing a reference to the broker) instead of once per event type per publisher
Defined in: event.js.

Constructor Summary
Constructor Attributes Constructor Name and Description
 
new Event.Broker()
Method Summary
Method Attributes Method Name and Description
 
addEventListener(event_type, event_listener, useCapture)
Register a listener with the broker.
 
registerEventsPublisher(event_types, publisher)
Register a publisher with the broker.
 
removeEventListener(event_type, event_listener, useCapture)
Un-register a listener with the broker.
 
tracing/debugging feature only toggles event tracing on all of the publishers of a given type of event note: this is a first pass at this feature.
 
unregisterEventsPublisher(event_types, publisher)
Unregister a publisher with the broker.
Constructor Detail
new Event.Broker()
Method Detail
addEventListener(event_type, event_listener, useCapture)
Register a listener with the broker. Causes the listener to be automatically registered with all publishers that produce the specified event_type. You shouldn't have to call this from your own code: it's called automatically when your listener listens for events from the broker. See Event.Listener.listenForEvent
Parameters:
event_type
event_listener
useCapture

registerEventsPublisher(event_types, publisher)
Register a publisher with the broker. Listeners that want the types of events produced by this publisher will be subscribed automatically.
Parameters:
{StringorArray} event_types
{Object} publisher

removeEventListener(event_type, event_listener, useCapture)
Un-register a listener with the broker. The listener is "unsubscribed" from all publishers of the given event_type You shouldn't have to call this from your own code: it's called automatically when your listener stops listening for events from the broker. See Event.Listener.stopListeningForEvent
Parameters:
event_type
event_listener
useCapture

toggleEventPublishersTrace(event_type)
tracing/debugging feature only toggles event tracing on all of the publishers of a given type of event note: this is a first pass at this feature. Since it toggles the trace feature, toggling event tracing on two different event_types could activate trace for an object via the first event type, and then deactivate it with the second event type
Parameters:
event_type

unregisterEventsPublisher(event_types, publisher)
Unregister a publisher with the broker. Listeners that had been automatically subscribed to the publisher will be un-subscribed.
Parameters:
{StringorArray} event_types
{Object} publisher

Documentation generated by JsDoc Toolkit 2.0.b2 on Thu Feb 21 2008 20:16:55 GMT+0100 (CET)