Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Question for facade class?  (Read 6170 times)
marks416
Sr. Member
****
Posts: 52


View Profile Email
« on: October 13, 2008, 02:43:45 »

Hi,

I am new for pureMVC, I knwo facade class have the following methods

removeMediator
removeCommand   
removeProxy

I wonder when we need to use the methods and the purpose to use them( for save monory,garbage collection or others).

Thanks for your help.

Mark
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« 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>
Logged
Pages: [1]
Print