org::puremvc::perl5::patterns::observer::Observer
Implementation of the pureMVC Observer
pattern.
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 of the interested object.
Provide methods for setting the notification method and context.
Provide a method for notifying the interested object.
sub new( $notify_method, $notify_context );
Constructor.
$notify_method
notification method on $notify_context
interested object should take one parameter of type Notification.
Parameters
$notify_method - String
Method name inside $notify_context
object which is called when notifying $notify_context
.
$notify_context - *
Object interested in being notified.
sub notifyObserver( $notification );
Notifies the interested object.
Parameters
$notification - org::puremvc::perl5::patterns::observer::Notification
The notification to pass to the interested object's notification method.
sub setNotifyMethod( $notify_method );
Notification method setter.
Parameters
$notify_method - String
Method name inside context
object which is called when notifying context
object.
Notification method getter.
Returns
String
- Method name inside context
object which is called when notifying context
object.
sub setNotifyContext( $notify_context );
Notification context
setter.
Parameters
$notify_context - *
Object interested in being notified.
Notification context
getter.
Returns
*
- Object interested in being notified.
org::puremvc::perl5::core::Model
org::puremvc::perl5::core::View
org::puremvc::perl5::core::Controller
org::puremvc::perl5::patterns::facade::Facade
org::puremvc::perl5::patterns::observer::Notification
org::puremvc::perl5::patterns::proxy::Proxy
org::puremvc::perl5::patterns::mediator::Mediator
org::puremvc::perl5::patterns::command::SimpleCommand