Mediator: onRegister called before preRegister?

johncblandii's Avatar

johncblandii

07 May, 2010 05:13 PM

12:09:52.578 [INFO] views.mediators.ApplicationMediator onRegister()
12:09:52.602 [INFO] views.mediators.ApplicationMediator preRegister()

That's from my logging.

    /**
     * @inheritDoc
     */
    override public function onRegister():void{
        super.onRegister();
        _logger.info("onRegister()");
    }

    /**
     * @inheritDoc
     */
    override public function preRegister():void{
        super.preRegister();
        _logger.info("preRegister()");
    }

This is from my CoreMediator class which my mediators extend. My core merely manages initializing logging and doing some basic logging. After implementing it I noticed the logging showed on before pre, which doesn't make sense to me.

Am I misunderstanding the two methods?

  1. Support Staff 1 Posted by Shaun Smith on 07 May, 2010 05:24 PM

    Shaun Smith's Avatar

    preRegister is always called first, but sometimes it calls onRegister immediately:

    http://github.com/robotlegs/robotlegs-framework/blob/v1.0.3/src/org...

    If you put your trace statements before the calls to super things should make a little more sense :)

  2. 2 Posted by johncblandii on 07 May, 2010 05:33 PM

    johncblandii's Avatar

    100% correct. :-)

    I moved my log messages above the super calls and the order is correct.

    Thanks!

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