Package puremvc :: Module interfaces :: Class IObserver
[hide private]
[frames] | no frames]

classobj IObserver

source code

Known Subclasses:

The interface definition for a PureMVC Observer.

In PureMVC, IObserver implementors assume these responsibilities:

Encapsulate the notification (callback) method of the interested object.

Encapsulate the notification context of the interested object.

Provide methods for setting the interested object' notification method and context.

Provide a method for notifying the interested object.

PureMVC does not rely upon underlying event models such as the one provided with Flash, and ActionScript 3 does not have an inherent event model.

The Observer Pattern as implemented within PureMVC exists to support event driven communication between the application and the actors of the MVC triad.

An Observer is an object that encapsulates information about an interested object with a notification method that should be called when an INotification is broadcast. The Observer then acts as a proxy for notifying the interested object.

Observers can receive Notifications by having their notifyObserver method invoked, passing in an object implementing the INotification interface, such as a subclass of Notification.


See Also:
IView, INotification
Instance Methods [hide private]
 
setNotifyMethod(self, notifyMethod)
Set the notification method.
source code
 
setNotifyContext(self, notifyContext)
Set the notification context.
source code
 
notifyObserver(self, notification)
Notify the interested object.
source code
 
compareNotifyContext(self, object)
Compare the given object to the notificaiton context object.
source code
Method Details [hide private]

setNotifyMethod(self, notifyMethod)

source code 

Set the notification method.

The notification method should take one parameter of type INotification

Parameters:
  • notifyMethod - the notification (callback) method of the interested object

setNotifyContext(self, notifyContext)

source code 

Set the notification context.

Parameters:
  • notifyContext - the notification context of the interested object

notifyObserver(self, notification)

source code 

Notify the interested object.

Parameters:
  • notification - the INotification to pass to the interested object's notification method

compareNotifyContext(self, object)

source code 

Compare the given object to the notificaiton context object.

Parameters:
  • object - the object to compare.
Returns:
boolean indicating if the notification context and the object are the same.