我正在使用 puremvc 框架来开发基于 flex 的项目。我的问题与延迟注册代理类和中介类的最佳方法有关?目前在启动命令上,我正在注册启动调解器。
我的代码有:
- ApplicationFacade.as
- 启动命令.as
- 启动调解器.as
- 登录命令.as
- 登录中介者.as
- 登录代理.as
- 登录视图.as
在ApplicationFacade.as我正在向StartupCommand发送通知。StartupCommand注册StartupMediator。
现在我的问题:
- 何时何地注册 LoginMediator?
- 何时何地注册 LoginProxy?
- 何时向 LoginCommand发送通知?
如果我们在LoginCommand中注册LoginMediator和 LoginProxy就像
公共类 LoginCommand 扩展 SimpleCommand 实现 ICommand { 覆盖公共函数执行(通知:INotification):无效 { 外观.registerProxy(新登录代理()); 门面.registerMediator(新的LoginMediator(app)); } }现在,如果我 多次 发送LoginCommand通知,那么它会创建多个LoginProxy和LoginMediator 实例。那么如何避免呢?