tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/2219-removing-a-views-eventlistener-without-removing-the-viewRobotlegs: Discussion 2018-10-18T16:35:47Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/262640312013-04-06T17:12:58Z2013-04-06T17:12:58ZRemoving a view's EventListener without removing the view ?<div><p>Hi all,</p>
<p>I have a view in my app and its mediator, everything works fine
when starting the application</p>
<p>My view has a 'visible' property, in the application, because I
sometimes need to hide it.</p>
<p>When the 'visible' property is set to false, it also removes all
the EventListeners added at the view's instanciation.</p>
<p>The problem is that, by doing so, when setting the 'visible'
property back to true, the mediator doesn't react anymore ! !</p>
<p>What should be the way to handle such a case?</p></div>poq2011tag:robotlegs.tenderapp.com,2009-10-18:Comment/262640312013-04-06T18:30:34Z2013-04-06T18:30:34ZRemoving a view's EventListener without removing the view ?<div><p>Hi,</p>
<p>Setting a <code>visible</code> to false on a view should not
destroy that view's mediator. Are you using any other
frameworks/libraries?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/262640312013-04-06T22:20:03Z2013-04-06T22:20:03ZRemoving a view's EventListener without removing the view ?<div><p>In my view, I have overridden the setter of the visible property
to remove the event listeners ( by using the removeEventListener
method) when visible is set to false. I did this to gain
performance (since the view is not visible, the listeners are not
usefull)</p>
<p>When visible is set to true I re-enable the listeners by calling
the addEventListemer.</p>
<p>However, doing this breaks the link with the mediator. How can I
force the view listeners to 'pause' when the view is not
visible?</p></div>poq2011tag:robotlegs.tenderapp.com,2009-10-18:Comment/262640312013-04-07T00:48:58Z2013-04-07T00:48:58ZRemoving a view's EventListener without removing the view ?<div><blockquote>
<p>However, doing this breaks the link with the mediator</p>
</blockquote>
<p>I'm not quite sure what you mean by this. Could you explain a
bit more? Also:</p>
<blockquote>
<p>In my view, I have overridden the setter of the visible property
to remove the event listeners</p>
</blockquote>
<p>Are these internal listeners (internal to the view) or do they
somehow relate to the mediator?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/262640312013-04-07T14:16:23Z2013-04-07T14:16:23ZRemoving a view's EventListener without removing the view ?<div><p>Indeed, setting a visible to false on a view doesn't destroy
that view's mediator.</p>
<p>It seems that my problem is coming from the fact that I have a
several instances of the same View.</p>
<p>I'm closing this discussion to open a new one on mediator and
multiple instances of view.</p></div>poq2011