I created a Factory Class that would do just that. Since I was trying to treat each Module as an autonomous mini-application, I decided that I needed a CairngormEventDispatcher specifically for each Module and the Application. Sadly I was not afforded that luxury, so I had to find another way. If you do not use any Caingorm in your shell application, you will not run into these issues, so for some that might be the quick solution. if(event is ContactEvent) doesn't work since the event is in fact a ContactEvent. " cannot convert to .ContactEvent." Trying to test for it, i.e. The other modules will throw the following exception: ContactEvent(event), it will only work in the module that actually originated the event. When an event is received by a command, and you try to cast that event back to its origin, i.e. If you loaded 3 instances of that module, your controller would execute 3 commands, once for each module. So, say your module was listening for the ContactEvent.LOAD_CONTACT event. Running through the debugger, I noticed that as I loaded each new instance of the same module, event listeners were added to the singleton's eventDispatcher. So, adding the appcontroller to the application will in fact get an instance of the dispatcher. If the shell app gets an instance of this class, then any Modules that load will use the same instance. There were funky things happening again when events were triggered - weird casting errors, events firing across multiple module instances, shared models, etc.ĬairngormEventDispatcher basically returns a singleton. I determined that the shell needed to use a different controller than the module, but that wasn't enough (though still necessary). The minute I add in the line to my shell app, subsequent instances of the module don't load properly. Why? Because the shell is built on the Cairngorm framework as well. However, when I tried loading multiple instances of the module into the actual application, things died. In itself, the module works fine, and after the progress from the other day, loading multiple instances of the module into a simple shell works fine too. I have one complex flex module that is built on the Cairngorm 2.2 framework. I am still fighting with getting modules to load properly and independently of each other and the shell flex application. This is really a sequel to my previous blog. Having said that, I am blogging today because even though I've sort of fixed my latest issues, I'm not entirely sure I've used the best approach. I've been relocated to the spare bedroom so that I can actually function during the day, however I'm missing about 30 hours of sleep this week that I'll never get back. Let me say, first off, that my wife gave birth to a beautiful baby girl on Wednesday morning, and they are doing just fine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |