I am using puremvc framework for developing flex based project. My question is related to what is best way to delayed registering proxy class and mediator class ? Currently on startup command I am registering startup mediator.
My code has :
- ApplicationFacade.as
- StartupCommand.as
- StartupMediator.as
- LoginCommand.as
- LoginMediator.as
- LoginProxy.as
- LoginView.as
In ApplicationFacade.as I am sending notification to StartupCommand. StartupCommand registers StartupMediator.
Now my question:
- When and where to register LoginMediator ?
- When and where to register LoginProxy ?
- When to send notification to LoginCommand ?
If we registers LoginMediator and LoginProxy in LoginCommand like
public class LoginCommand extends SimpleCommand implements ICommand { override public function execute(notification:INotification):void { facade.registerProxy( new LoginProxy() ); facade.registerMediator( new LoginMediator( app ) ); } }
Now if I am sending notification for LoginCommand multiple times then it creates multiple instace of LoginProxy and LoginMediator. So how to avoid it ?