Observer

Observer

new Observer()

A base Observer implementation.

An `Observer` is an object that encapsulates information about an interested object with a method that should be called when a particular `Notification` is broadcast.

In PureMVC, the `Observer` class assumes 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 notification method and context.
  • Provide a method for notifying the interested object.
Source:

Members

notifyContext

Get the notifyContext

Source:

notifyContext

Set the notification context.

Source:

notifyMethod

Get the notification method.

Source:

notifyMethod

Set the notification method.

The notification method should take one parameter of type `Notification`.

Source:

Methods

compareNotifyContext(notifyContext) → {boolean}

Compare an object to the notification context.

Source:
Parameters:
Name Type Description
notifyContext Object
Returns:
Type:
boolean

notifyObserver(notification)

Notify the interested object.

Source:
Parameters:
Name Type Description
notification Notification

Observer

new Observer(notifyMethod, notifyContext)

Constructor.

The notification method on the interested object should take one parameter of type `Notification`

Source:
Parameters:
Name Type Description
notifyMethod function
notifyContext Object

Members

notifyContext

Get the notifyContext

Source:

notifyContext

Set the notification context.

Source:

notifyMethod

Get the notification method.

Source:

notifyMethod

Set the notification method.

The notification method should take one parameter of type `Notification`.

Source:

Methods

compareNotifyContext(notifyContext) → {boolean}

Compare an object to the notification context.

Source:
Parameters:
Name Type Description
notifyContext Object
Returns:
Type:
boolean

notifyObserver(notification)

Notify the interested object.

Source:
Parameters:
Name Type Description
notification Notification