PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: codecraig on August 07, 2008, 05:12:03



Title: Removing Unused Mediators - should it be done when using ViewStack?
Post by: codecraig on August 07, 2008, 05:12:03
So there is a blog post about the "10 tips for working with PureMVC" (http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/ (http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/)).

Number 8 says:

In some cases you don’t use a Mediator and its View Components anymore. Then remove the Mediator using facade.removeMediator(MyMediator.NAME); in conjunction with a self created destroy() method to remove the ViewComponent including all listeners, timer, references, etc. for a successful garbage collection.

So with a ViewStack, when the user is no longer looking at a view is it best to remove the mediator, listeners, etc for the view that is no longer being displayed (b/c the user chose to view a different element of the ViewStack?


Title: Re: Removing Unused Mediators - should it be done when using ViewStack?
Post by: puremvc on August 07, 2008, 05:56:06
If the user may navigate back to that view, then no, it doesn't make sense, because you'll have to reinstate everything again. No point in it.

Even if they're never coming back to that screen, it probably will not hurt anything if they're left in place, but if you suspect they may react to notifications when they logically shouldn't, then you might want to take this step.

-=Cliff>