Browser rezise breaks Event/Command mapping in a Module

Igor Volk's Avatar

Igor Volk

19 Nov, 2010 11:16 AM

Hey guys,

Thank you for reading this. We are using Robotlegs 1.1 with Joel Hooks modular utility to build an application and have spotted a bug.

When browser is resized manually, this seems to completely break the mapping of Commands to Events inside a loded module Context. Modules load into a TabNavigator, so re-loading the broken module re-maps everything when Context.startup() is run again. However re-sizing browser again inevitably leads to the same failure.

Has anybody come across this strange behaviour?

Many thanks.

Igor

  1. 2 Posted by Stray on 19 Nov, 2010 12:49 PM

    Stray's Avatar

    Hi Igor - could you post the code that is breaking (ie your context mapping) - obviously with any sensitive stuff stripped out.

    Even better - if you can create a minimal version that demonstrates the breakage, we can take a closer look.

    The absolute best - if you can do it - would be a test added to the test suite that currently fails and should pass once the bug is fixed.

    Thanks,

    Stray

  2. 3 Posted by Igor Volk on 19 Nov, 2010 01:31 PM

    Igor Volk's Avatar

    Hey Stray,

    I have just found the reason for this fault. It is nothing to do with RL. Inside each module I had a cleanup() method ModuleMediator unmapping all events, commands, singletons etc when the module is removed. It was previously added to

    viewComponent.addEventListener(Event.REMOVED_FROM_STAGE, cleanup);

    weirdly this was firing when the application was being resized as part of the browser window. It didn't even occur to me to check for it first.

    Now I have changed the above line to:

    viewComponent.parent.addEventListener("unload", cleanup, false, 0, true);

    parent in this case is ModuleLoader and it all works fine.

    Thank you so much for looking into it.

    Igor

  3. 4 Posted by Stray on 19 Nov, 2010 02:05 PM

    Stray's Avatar

    Great - glad you found it, and good to have it in the knowledge base for people who have this problem in future.

    Thanks,

    Stray

  4. Stray closed this discussion on 11 Feb, 2011 05:21 PM.

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