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 Attributes | Constructor Name and Description |
|---|---|
|
new Event.Broker()
|
| 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.
|
|
|
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.
|
|
|
unregisterEventsPublisher(event_types, publisher)
Unregister a publisher with the broker.
|
- Parameters:
- event_type
- event_listener
- useCapture
- Parameters:
- {StringorArray} event_types
- {Object} publisher
- Parameters:
- event_type
- event_listener
- useCapture
- Parameters:
- event_type
- Parameters:
- {StringorArray} event_types
- {Object} publisher