tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/4166-how-to-know-when-mediators-of-remapped-views-are-all-initializedRobotlegs: Discussion 2018-10-18T16:35:50Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-24T09:58:55Z2013-07-24T09:58:55ZHow to know when mediators of remapped views are all initialized?<div><p>Why exactly do you want to keep track of their
initialization?<br>
I assume you have a bunch of views on the stage, their mediators
are<br>
unmapped and remapped and now you want to proceed to some next
phase, but<br>
only after all of the mediators have been initialized?<br>
I'm not completely familiar with the entire mediator mechanism in
RL2, but<br>
I'd think they are immediately (i.e. synchronously) instantiated
and<br>
initialized.<br>
If not, I'd let all relevant mediators dispatch an event upon<br>
initialization, create a helper class which listens to those events
and<br>
maintains a list of events it's interested in, once the list is
empty let<br>
it dispatch an event which triggers the next phase.</p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-24T10:03:54Z2013-07-24T10:03:54ZHow to know when mediators of remapped views are all initialized?<div><p>It doesn't seem like initialization of mediators works
synchronously.<br>
When I call a function after the remapping calls, this function
gets called before all mediators are initialized. I wanted to stay
away from that helper class you mention, so that's why I asked. But
I guess I should do smt like that, thanks.</p></div>JeffW.tag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-24T10:08:10Z2013-07-24T10:08:10ZHow to know when mediators of remapped views are all initialized?<div><p>Yeah, it could be the system waits a tick before initialization.
I know there's a bunch of magic needed to avoid destruction and
reinitialization of mediators in case a view is reparented.</p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-24T10:08:45Z2013-07-24T10:08:45ZHow to know when mediators of remapped views are all initialized?<div><p>Maybe another solution altogether would be better; why exactly
do you want to remap the views?</p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-24T10:13:02Z2013-07-24T10:13:02ZHow to know when mediators of remapped views are all initialized?<div><p>I'm working with two contexts and both need to be able to
fulfill two roles (master and slave). If a context switches from
role, I want to switch from mediator too (master or slave
mediator). I could stick to one mediator and check in there which
role it should have but I don't like the idea of code cluttered
with if statements.</p></div>JeffW.tag:robotlegs.tenderapp.com,2009-10-18:Comment/279299882013-07-25T17:21:49Z2013-07-25T17:21:49ZHow to know when mediators of remapped views are all initialized?<div><p>I switched to one mediator that can have two roles, because the
remapping brought a lot of problems, but at least now it all works,
thanks, gonna close this one!</p></div>JeffW.