org::puremvc::perl5::patterns::observer::Notifier
Implementation of the pureMVC Notifier
pattern.
commands, mediators and proxies all have a need to send notifications.
The Notifier
interface provides a common method called sendNotification
that relieves implementation code of the necessity to actually construct notifications.
The Notifier
class, which all of the above mentioned classes extend, provides an initialized reference to the facade singleton, which is convenient for sending notifications, but also eases implementation as these classes have frequent facade interactions and usually require access to the facade anyway.
sub sendNotification( $notification_name, $body, $type );
Keeps us from having to construct new Notification instances in our implementation code.
# Create and send a notification called "SayHelloWorld" with no body nor type data passed $self->sendNotification("SayHelloWorld");
Parameters
$notification_name
: name of the notification.
$body
: body or (business data) of the notification. Can be any object or scalar. - Optional
$type
: type of the notification. This data can be useful to distinguish several types of the same Notification
. Usually is a string but could be any other object or scalar. - Optional
PureMVC Notifier
subclasses ( Mediator, Proxy, SimpleCommand, MacroCommand ) usually do not need to access this property as they will access application Facade singleton using the following instruction:
my $facade = com::me::myapp::Facade->getInstance();
You should not have to access it and must not update it in normal usage.
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