tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/11555-why-not-pass-priority-and-useweakreference-to-the-addviewlistener-and-addcontextlistener-function-in-mediatorRobotlegs: Discussion 2014-08-07T12:10:01Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/338876422014-07-25T09:13:57Z2014-07-25T09:13:57Zwhy not pass priority and useWeakReference to the addViewListener and addContextListener function in Mediator<div><p>Hi,</p>
<p>You have 2 options:</p>
<ul>
<li>use the eventMap.mapListener instead of addViewListener or
addContextListener, and set the priority and useWeakReference as
you wish them to be :</li>
</ul>
<pre>
<code>eventMap.mapListener(view, SomeEvent.SOME_DATA_REQUESTED,
dispatch, false, 11, false);
eventMap.mapListener( eventDispatcher, SomeEvent.SOME_DATA_RECEIVED,
someHandler, false, 1, true);</code>
</pre>
<ul>
<li>open an issue on github: <a href=
"https://github.com/robotlegs/robotlegs-framework/issues">https://github.com/robotlegs/robotlegs-framework/issues</a></li>
</ul>
<p>In my experience, having useWeakReference set to true is a good
thing almost always, and I can't think of a scenario where the
opposite were desirable for a Mediator's event listener. As for the
priorities of event listeners, personally, I try to avoid relying
on a specific order of execution of event listeners. More often
than not, there are other architectural solutions to that problem.
I'm curious as to why you need to change those parameters. What is
your special/particular use case?</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/338876422014-07-29T01:18:08Z2014-07-29T01:18:08Zwhy not pass priority and useWeakReference to the addViewListener and addContextListener function in Mediator<div><p>Hi Ondina,<br>
In my use case,both mediatorA and mediatorB have the same event
listeners,and i need to make mediatorA's event handler happen
first,as you said there are other solutions to this problem,thanks
for your replies.</p></div>airycanontag:robotlegs.tenderapp.com,2009-10-18:Comment/338876422014-07-30T08:15:23Z2014-07-30T08:15:23Zwhy not pass priority and useWeakReference to the addViewListener and addContextListener function in Mediator<div><p>No problem:)</p></div>Ondina D.F.