mediator has access to the general eventDispatcher, but how do they do that?

Filex 's Avatar

Filex

30 Aug, 2012 06:21 PM

I have looked into the MediatorMap class, but still no clue.
in the createMediatorUsing function, mediator is instantiated like this:
mediator = injector.instantiate(config.mediatorClass);
when the mediator is created, it has a reference to the general eventDispatcher.
i guess the eventDispatcher is provided to mediator during the instantiation process.
then i check the injector Object, but it has no access to the general eventDispatcher.
HELP please~

  1. 1 Posted by Paul Robertson on 30 Aug, 2012 07:29 PM

    Paul Robertson's Avatar

    I'm assuming you're using RL1. For RL2 this may be different, so I'm not
    sure if it's true or not.

    The eventDispatcher (aka the "event bus") is mapped to the type
    IEventDispatcher, so any time a class defines an injection of type
    IEventDispatcher, the event bus is injected into instances of that class
    when they're created by the injector.

    In Mediator.as, it's right here:

    https://github.com/robotlegs/robotlegs-framework/blob/master/src/org/robotlegs/mvcs/Mediator.as#L62

    (The eventDispatcher setter accessor has an [Inject] tag over it, although
    it's before the comment so it's a bit disjointed.)

    Is that what you were trying to know?

    Paul

  2. 2 Posted by 5468sun on 30 Aug, 2012 08:42 PM

    5468sun's Avatar

    I'm using RL1. and i see the [Inject] tag now~ thank you Paul.
    I guess i need a new pair of glasses~

  3. Ondina D.F. closed this discussion on 31 Aug, 2012 07:04 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac