Title: About code structure Post by: badoumba on November 09, 2011, 11:24:14 Very quick and simple question.
What's the best practice if I have a variable that will be used by many mediators and skins and that I don't want to duplicate (a Matrix value). Should I place it in the facade? Thanks Title: Re: About code structure Post by: puremvc on November 10, 2011, 09:46:03 Don't store it on the Facade. That's the sort of thing that leads to Singletons having a bad reputation.
Instead, store it in a "transient Proxy". An instance of the framework Proxy class just used to hold an arbitrary value. Inside a PrepareViewCommand (or the 'view prep phase' of StartupCommand) // Store the Matrix Inside each Mediator that needs a reference to this matrix : protected var matrixProxy:IProxy; If there are a lot of these mediators, you might consider making an AbstractMediator they inherit from and call super.onRegister() from your subclasses to get the matrix proxy.Inside a Command that needs to reference the Matrix var matrixProxy:IProxy = facade.retrieveProxy(AppConstants.MATRIX); |