/* PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved. Your reuse is governed by the Creative Commons Attribution 3.0 United States License */ package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.facade.Facade; /** * A Base INotifier implementation. * *

* MacroCommand, Command, Mediator and Proxy * all have a need to send Notifications.

*

* The INotifier 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 required for the convienience method * for sending Notifications, but also eases implementation as these * classes have frequent Facade interactions and usually require * access to the facade anyway.

* * @see org.puremvc.as3.patterns.facade.Facade Facade * @see org.puremvc.as3.patterns.mediator.Mediator Mediator * @see org.puremvc.as3.patterns.proxy.Proxy Proxy * @see org.puremvc.as3.patterns.command.SimpleCommand SimpleCommand * @see org.puremvc.as3.patterns.command.MacroCommand MacroCommand */ public class Notifier implements INotifier { /** * Create and send an INotification. * *

* Keeps us from having to construct new INotification * instances in our implementation code. * @param notificationName the name of the notiification to send * @param body the body of the notification (optional) * @param type the type of the notification (optional) */ public function sendNotification( notificationName:String, body:Object=null, type:String=null ):void { facade.sendNotification( notificationName, body, type ); } // Local reference to the Facade Singleton protected var facade:IFacade = Facade.getInstance(); } }