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]
Author Topic: Removing Unused Mediators - should it be done when using ViewStack?  (Read 8426 times)
Full Member
Posts: 23

View Profile Email
« 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/).

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?
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 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.

Pages: [1]