Objective-C API Library Reference  4.3.0-42-g45f162a
 All Classes Functions Typedefs Properties Pages
Public Functions | Public Static Functions | List of all members
PWNamedEventPublisher Class Reference

The PWNamedEventPublisher is a generic class for managing event subscription and notifications.

Public Functions

(BOOL) - addSubscriber:target:action:
 
(NSUInteger) - count
 
(BOOL) - fireEvent:object:
 
(BOOL) - fireEventOnMainThread:object:
 
(BOOL) - removeSubscriber:target:action:
 
(void) - removeSubscribersForTarget:
 
(BOOL) - subscriberExists:
 

Public Static Functions

(PWNamedEventPublisher *) + publisher
 

Methods Descriptions

- (BOOL) addSubscriber: (NSString *)  key
target: (id)  target
action: (SEL)  action 

Adds a handler (observer) for the specified key. Returns YES if a handler was added, or NO if it was not.

Parameters
keyThe key.
targetThe target object to be notified of the event.
actionThe selector to be called when the event occurs.
- (NSUInteger) count

Returns the total number of subscribers.

- (BOOL) fireEvent: (NSString *)  key
object: (id)  object 

Executes the handler for the specified key. Returns YES if event was found and executed, or NO if it was not.

Parameters
keyThe key.
objectThe object to pass to target/action.
- (BOOL) fireEventOnMainThread: (NSString *)  key
object: (id)  object 

Executes the handler for the specified key on the main thread. Returns YES if event was found and executed, or NO if the handler was not found.

Parameters
keyThe key.
objectThe object to pass to target/action.
+ (PWNamedEventPublisher *) publisher

Returns an autoreleased publisher.

- (BOOL) removeSubscriber: (NSString *)  key
target: (id)  target
action: (SEL)  action 

Removes a handler (observer) for the specified key. Returns YES if a handler was removed, or NO if it was not.

Parameters
keyThe key.
targetThe target object to be notified of the event.
actionThe selector to be called when the event occurs.
- (void) removeSubscribersForTarget: (id)  target

Removes all handlers for the specified target.

- (BOOL) subscriberExists: (NSString *)  key

Returns a Boolean value indicating whether the specified subscriber exists.