PureMVC ApplicationFacade Class Template


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /**
  2. * Base PureMVC Project
  3. */
  4. package {
  5.  
  6. import org.puremvc.as3.interfaces.IFacade;
  7. import org.puremvc.as3.patterns.facade.Facade;
  8. import controller.*;
  9.  
  10. /**
  11. * Simple ApplicationFacade for PureMVC Structured Project
  12. */
  13.  
  14. public class ApplicationFacade extends Facade implements IFacade {
  15.  
  16. /**
  17. * Notification name constants
  18. */
  19. public static const STARTUP:String = "startup";
  20.  
  21. /**
  22. * Singleton ApplicationFacade Factory Method
  23. */
  24. public static function getInstance(): ApplicationFacade {
  25.  
  26. if (instance == null) {
  27. instance = new ApplicationFacade( );
  28. }
  29. return instance as ApplicationFacade;
  30. }
  31.  
  32. /**
  33. * Broadcast the STARTUP Notification
  34. */
  35. public function startup(app:Object):void {
  36. sendNotification( STARTUP, app );
  37. }
  38.  
  39. /**
  40. * Register Commands with the Controller
  41. */
  42. override protected function initializeController():void
  43. {
  44. super.initializeController();
  45.  
  46. registerCommand(STARTUP, StartupCommand);
  47. }
  48. }
  49. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.