@Pierre Laveklint this will not work in my case, because some
views are not on the stage on the moment when the reset should be
@Stray I think relaxed eventMap will not work for me as well.
The problem is that the user may notice some "blinking" when the
components are removed from stage when he/she logs in again. I was
thinking about not removing of the mediator, but this also means
that I will have to check several other things. The thing is that
some of my views may accept the same event. It's not a problem in
normal workflow, because they are never placed on the stage at the
same time thus they are never mediated at the same time. I wonder
whether I can create 2 different mediators for the same view. Then
the second mediator will never be deleted and I will only put reset
handler there. Is it normal practice, or is it something completely
Another idea has just came to my mind and I wonder what you guys
think about it. So, I have reset function in several views that
should be reset at some point of workflow. What if I create some
ResetModel. This model can hold callbacks. When the view is
created, the reference to the reset function will be send to the
ResetModel (via some Command). This way, i will not care if the
view that should be reset is on the stage, and I also do not need
to hold mediators when they are not needed.
You can manually create extra mediators - all you need to do is not put an inject tag on the view, use the injector to get a new mediator instance, and then set the view manually. Then run setViewComponent(view) on the mediator, and then preRegister().
How big a project is it? I've got the Robotlegs 2 mediator map working with Robotlegs 1 mediators ... so in theory you could use that - which also allows you to create multiple mediators per view.
It's still alpha, but if your project is more than another week or so long then that might be as good a solution.
A final option would be to wire a signal direct into your view components - and use a command to update those signals.
The project are going to continue for another several weeks, but
as long as this is phase 1 of it, which will be released very soon,
I will go with robotlegs 1 for now.
I have not drilled into Signals yet, heard a lot of good stuff
about them. Hope will try them in my next project.
Stray, could you please describe your first paragraph in more
details? Where exactly should I create this new mediator, where I
will be able to remove it when it's no longer needed. Maybe some
small code snippet? :)
Thanks, Stray for your help and examples! It's clear now. Could
you please share your thoughts about my idea of creating
ResetModel, which will hold callback functions from view (reset
functions in my particular case).