puremvc
|
 |
« Reply #1 on: October 13, 2008, 03:05:08 » |
|
Precisely. Things should be generally be removed when they are no longer needed. Some Mediators, Proxies and Commands stay registered throughout the entire running application, because that is their lifecycle.
But, for instance, you might have a Flex component that has 3 states. And when it changes states, you want different mediators to be registered for the sub components that get added in the new state, and to remove the mediators for components from the previous state which are removed.
If you do not remove the mediator, then even though Flex has removed the component from the view, the mediator still has a reference to the component and it will not be garbage collected. In fact inside an app I'm refactoring for a client at the moment, that very problem leads to a video continuing to play and its sound to be heard even when you log out of the application and the video component has been removed from the display and replaced by a Login box.
-=Cliff>
|