API 0.9.5
CPNotificationCenter Class Reference

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

#import <CPNotificationCenter.h>

Inheritance diagram for CPNotificationCenter:

List of all members.

Instance Methods

(void) - addObserver:selector:name:object:
(id) - init
(void) - postNotification:
(void) - postNotificationName:object:
(void) - postNotificationName:object:userInfo:
(void) - removeObserver:
(void) - removeObserver:name:object:

Class Methods

(CPNotificationCenter+ defaultCenter

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

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

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 76 of file CPNotificationCenter.j.

+ (CPNotificationCenter) defaultCenter

Returns the application's notification center

Definition at line 48 of file CPNotificationCenter.j.

- (id) init

Definition at line 56 of file CPNotificationCenter.j.

- (void) postNotification: (CPNotification aNotification

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 135 of file CPNotificationCenter.j.

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

Posts a new notification with the specified name and object.

Parameters:
aNotificationNamethe name of the notification
anObjectthe associated object

Definition at line 159 of file CPNotificationCenter.j.

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

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 149 of file CPNotificationCenter.j.

- (void) removeObserver: (id)  anObserver

Unregisters the specified observer from all notifications.

Parameters:
anObserverthe observer to unregister

Definition at line 97 of file CPNotificationCenter.j.

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

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 114 of file CPNotificationCenter.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines