PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: Vishwas on November 21, 2011, 09:16:30



Title: Is it mandatory to use removeMediator when not using mediator anymore
Post by: Vishwas on November 21, 2011, 09:16:30
Hi!
Is removeMediator like removeListener, which should be used after mediator is not meant to be used anymore. Is it mandatory...like if i don't use it, would it add to garbage ?


Title: Re: Is it mandatory to use removeMediator when not using mediator anymore
Post by: puremvc on November 21, 2011, 09:27:15
If your view component is removed from the view hierarchy (display list in Flash) and is no longer needed, then if that component has an associated mediator you should remove it, yes. If you are using Flash/Flex/AIR, you can listen to the component for Event.REMOVED and respond by having the mediator remove itself with:
:
facade.remove(this.getMediatorName());
-=Cliff>