Dart DocumentationpuremvcIObserver

IObserver Interface

The interface definition for a PureMVC MultiCore Observer.

In PureMVC, IObserver implementors assume these responsibilities:

  • Encapsulate the notification (callback) method of the interested object.
  • Encapsulate the notification context (this) of the interested object.
  • Provide methods for setting the interested object's notification method and context.
  • Provide a method for notifying the interested object.

The Observer Pattern as implemented within PureMVC exists to support publish/subscribe communication between actors.

An IObserver is an object that encapsulates information about an interested object with a notification (callback) method that should be called when an INotification is broadcast. The IObserver then acts as a conduit for notifying the interested object.

IObservers can receive Notifications by having their notifyObserver method invoked, passing in an object implementing the INotification interface.

See IView, INotification

Implemented by

Observer

Methods

Code bool compareNotifyContext(Object object) #

Compare a given object to the notifyContext object.

  • Param Object - the object to compare.
  • Returns bool - whether the given object and the notifyContext are the same.
bool compareNotifyContext( Object object );

Code Object getNotifyContext() #

Get the notification context.

  • Returns Object - the caller.
Object getNotifyContext();

Code Function getNotifyMethod() #

Get the notification method.

  • Returns Function - the notification (callback) method of the interested object.
Function getNotifyMethod();

Code Object get notifyContext() #

Object get notifyContext();

Code void set notifyContext(Object caller) #

This IObserver's notifyContext (i.e., caller)

void set notifyContext( Object caller );

Code Function get notifyMethod() #

Function get notifyMethod();

Code void set notifyMethod(Function callback) #

This IObserver's notifyMethod (i.e., callback)

void set notifyMethod( Function callback );

Code void notifyObserver(INotification note) #

Notify the interested object.

void notifyObserver( INotification note );

Code void setNotifyContext(Object caller) #

Set the notification context.

  • Param caller - a reference to the object to be notified.
void setNotifyContext( Object caller );

Code void setNotifyMethod(Function callback) #

Set the notification method.

The notification method should take one parameter of type INotification.

  • Param notifyMethod - the notification (callback) method of the interested object.
void setNotifyMethod( Function callback );