Observer class

A base IObserver implementation.

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 types

Constructors

Observer(Function notifyMethod, [Object notifyContext])
Constructor. [...]

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
notifyContext Object
This IObserver's notifyContext (i.e., caller)
read / write, override
notifyMethod Function
This IObserver's notifyMethod (i.e., callback)
read / write, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

compareNotifyContext(Object object) bool
Compare a given object to the notifyContext (caller) object. [...]
override
getNotifyContext() Object
Get the notification context. [...]
override
getNotifyMethod() Function
Get the notification method. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyObserver(INotification notification) → void
Notify the interested object. [...]
override
setNotifyContext(Object caller) → void
Set the notification context. [...]
override
setNotifyMethod(Function callback) → void
Set the notification method. [...]
override
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited