dispatchEvent in Context

Enrique's Avatar


28 Jul, 2011 08:50 PM

Hi ! I think that you need to add a method "dispatch" in Context (or ContextBase) class.

At least for me is a bit confusing to have a dispatchEvent that dispatch a framework event.
When I write "dispatch" I know that I'm using the framework event bus, when I use dispatchEvent I know that I'm using a custom dispatcher (probably a view).

But In Context we use dispatchEvent instead of dispatch :(

Regards !

  1. Support Staff 1 Posted by Ondina D.F. on 29 Jul, 2011 09:50 AM

    Ondina D.F.'s Avatar

    Hi Enrique,

    Believe it or not, but it still happens to me too, from time to time:

    I type dispatch instead of dispatchEvent in the Context’s implementation

    , and I’m not new to rl.

    I don’t know the exact reason for not having this

    protected function dispatch(event:Event):Boolean
            return eventDispatcher.dispatchEvent(event);
        return false;  

    in the org.robotlegs.mvcs.Context.as.
    Probably because the Context is considered to be just a “container” for the rl actors, and its roles should be limited to: “provide initialization, provide de-initialization, and provide the central event bus for communication” and not more?
    So except for ContextEvent.STARTUP, ContextEvent.STARTUP_COMPLETE, ContextEvent.SHUTDOWN_COMPLETE, which are provided as a hook, to facilitate the startup process, the Context shouldn’t dispatch any other framework events, I guess.


  2. 2 Posted by Enrique on 29 Jul, 2011 12:40 PM

    Enrique's Avatar

    mmm... I think that the real reason for having dispatchEvent instead of dispatch is that ContextBase implements IEventDispatcher, so we need a dispatchEvent.
    But we can add a dispatch method too.

  3. Ondina D.F. closed this discussion on 02 Nov, 2011 05:56 PM.

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

Keyboard shortcuts


? 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