lb.core.events.publisher

Core Events Publisher

The publisher manages a list of subscribers, which get all notified of every event published until they get removed from the list.

Authors

Copyright

Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved

License

BSD License http://creativecommons.org/licenses/BSD/

Version

2011-08-14

Summary
lb.core.events.publisherCore Events Publisher
Functions
getSubscribers(): arrayGet the list of subscribers.
addSubscriber(subscriber)Add a new subscriber to the list.
removeSubscriber(subscriber)Remove an existing subscriber from the list.
publish(event)Publish an event to be broadcast to all subscribers.

Functions

getSubscribers(): array

Get the list of subscribers.

Returns

array, the list of subscribers (lb.core.events.Subscriber)

addSubscriber(subscriber)

Add a new subscriber to the list.

Parameter

subscriberobject, the new subscriber (lb.core.events.Subscriber)

Note

Nothing happens in case the subscriber is already present.

removeSubscriber(subscriber)

Remove an existing subscriber from the list.

Parameter

subscriberobject, the old subscriber (lb.core.events.Subscriber)

Note

Nothing happens in case the subscriber is not present.

publish(event)

Publish an event to be broadcast to all subscribers.

Parameter

eventobject, the event object

Note

All subscribers present at the start of the call will get notified.  Adding or removing a subscriber during the publication of an event will only have effect for subsequent events.

Subscriber to Core Events
Close