Skip to content

Multiple Mediation Order #179

@prankard

Description

@prankard

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions