Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multiple Mediation Order #179

Open
prankard opened this issue Sep 20, 2015 · 1 comment
Open

Multiple Mediation Order #179

prankard opened this issue Sep 20, 2015 · 1 comment

Comments

@prankard
Copy link

So I've been doing a lot of multiple mediation recently (which is really cool). Just tagging a whole lot of view objects with interfaces to give it lots of new functionality/abilities.

But when doing so a lot, I've had a couple of cases where mediators need to run a particular order.

You've made a cool initialize and destroy order.

preInitialize
initialize
postInitialize
preDestroy
destroy
postDestroy

But when mediating a view with 2 mediators. The order isn't what I expected to happen. I wanted to make sure code was run a particular mediator before another one.

Here is the current order:

Mediator A - preInitialize
Mediator A - initialize
Mediator A - postInitialize
Mediator B - preInitialize
Mediator B - initialize
Mediator B - postInitialize
Mediator A - preDestroy
Mediator A - destroy
Mediator A - postDestroy
Mediator B - preDestroy
Mediator B - destroy
Mediator B - postDestroy

Can I change it like so:

Mediator A - preInitialize
Mediator B - preInitialize
Mediator A - initialize
Mediator B - initialize
Mediator A - postInitialize
Mediator B - postInitialize
Mediator A - preDestroy
Mediator B - preDestroy
Mediator A - destroy
Mediator B - destroy
Mediator A - postDestroy
Mediator B - postDestroy

I'm working on the code now, but wanted to make sure there wasn't a reason for the previous method.

@ivan-shaban
Copy link

Hi, how about implement that behaviour like a toggled feature (e.g. in mediator map)? I think in some cases first behaviour a useful, and in other the second?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants