API  1.0.0
CPNotificationCenter Class Reference

Sends messages (CPNotification) between objects. More...

#import <CPNotificationCenter.h>

+ Inheritance diagram for CPNotificationCenter:

Instance Methods

(void) - addObserver:selector:name:object:
 
(id< CPObject >) - addObserverForName:object:queue:usingBlock:
 
(id) - init
 
(void) - postNotification:
 
(void) - postNotificationName:object:
 
(void) - postNotificationName:object:userInfo:
 
(void) - removeObserver:
 
(void) - removeObserver:name:object:
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Class Methods

(CPNotificationCenter+ defaultCenter
 
- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

Sends messages (CPNotification) between objects.

Cappuccino provides a framework for sending messages between objects within a process called notifications. Objects register with an CPNotificationCenter to be informed whenever other objects post CPNotifications to it matching certain criteria. The notification center processes notifications synchronously – that is, control is only returned to the notification poster once every recipient of the notification has received it and processed it.

Definition at line 2 of file CPNotificationCenter.h.

Method Documentation

◆ addObserver:selector:name:object:()

- (void) addObserver: (id)  anObserver
selector: (SEL)  aSelector
name: (CPString aNotificationName
object: (id)  anObject 
implementation

Adds an object as an observer. The observer will receive notifications with the specified name and/or containing the specified object (depending on if they are nil.

Parameters
anObserverthe observing object
aSelectorthe message sent to the observer when a notification occurs
aNotificationNamethe name of the notification the observer wants to watch
anObjectthe object in the notification the observer wants to watch

Definition at line 77 of file CPNotificationCenter.j.

◆ addObserverForName:object:queue:usingBlock:()

- (id< CPObject >) addObserverForName: (CPString aNotificationName
object: (id)  anObject
queue: (CPOperationQueue queue
usingBlock: (Function)  block 
implementation

Adds an entry to the receiver’s dispatch table with a block, and optional criteria: notification name and sender.

Parameters
aNotificationNamethe name of the notification the observer wants to watch
anObjectthe object in the notification the observer wants to watch
Theoperation queue to which block should be added. If you pass nil, the block is run synchronously on the posting thread.
blockthe block to be executed when the notification is received.

Definition at line 92 of file CPNotificationCenter.j.

◆ defaultCenter()

+ (CPNotificationCenter) defaultCenter
implementation

Returns the application's notification center

Definition at line 48 of file CPNotificationCenter.j.

◆ init()

- (id) init
implementation

Initializes the receiver

Returns
the initialized receiver

Reimplemented from CPObject.

Definition at line 56 of file CPNotificationCenter.j.

◆ postNotification:()

- (void) postNotification: (CPNotification aNotification
implementation

Posts a notification to all observers that match the specified notification's name and object.

Parameters
aNotificationthe notification being posted
Exceptions
CPInvalidArgumentExceptionif aNotification is nil

Definition at line 162 of file CPNotificationCenter.j.

◆ postNotificationName:object:()

- (void) postNotificationName: (CPString aNotificationName
object: (id)  anObject 
implementation

Posts a new notification with the specified name and object.

Parameters
aNotificationNamethe name of the notification
anObjectthe associated object

Definition at line 186 of file CPNotificationCenter.j.

◆ postNotificationName:object:userInfo:()

- (void) postNotificationName: (CPString aNotificationName
object: (id)  anObject
userInfo: (CPDictionary aUserInfo 
implementation

Posts a new notification with the specified name, object, and dictionary.

Parameters
aNotificationNamethe name of the notification name
anObjectthe associated object
aUserInfothe associated dictionary

Definition at line 176 of file CPNotificationCenter.j.

◆ removeObserver:()

- (void) removeObserver: (id)  anObserver
implementation

Unregisters the specified observer from all notifications.

Parameters
anObserverthe observer to unregister

Definition at line 124 of file CPNotificationCenter.j.

◆ removeObserver:name:object:()

- (void) removeObserver: (id)  anObserver
name: (CPString aNotificationName
object: (id)  anObject 
implementation

Unregisters the specified observer from notifications matching the specified name and/or object.

Parameters
anObserverthe observer to remove
aNotificationNamethe name of notifications to no longer watch
anObjectnotifications containing this object will no longer be watched

Definition at line 141 of file CPNotificationCenter.j.


The documentation for this class was generated from the following files: