PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: rosscoco on June 05, 2008, 04:17:50



Title: Application Startup Notification Confusion
Post by: rosscoco on June 05, 2008, 04:17:50
Not so much a problem, but rather am confused as to WHY something is working when I expected it not too  :o

I have a Startup MacroCommand that executes InitView then InitModel commands, and in the InitView SimpleCommand I instantiate an ApplicationMediator that has among its Notification interests  the very same ApplicationStartup notification that executed the StartupCommand. 

My confusion is what kind of causal loop time paradox ( or similar ) allows the ApplicationMediator to respond to a notification that was sent BEFORE it was instantiated or registered with the facade, because that's what seems to be happening?   

If, in a Notification 'lifecycle', an object is instantiated/registered, does some bit of magic occur that checks if this Notification is listed in the new objects interests?  If so, well....very clever :) 








Title: Re: Application Startup Notification Confusion
Post by: puremvc on June 05, 2008, 06:23:36
You've discovered the Flux Capacitor! It causes wierd time dialation effects and runs on Fritos and beer cans!

What's actually happening is that in View.notifyObserver, we're looping through the list of observers for the Notification, and before finishing that loop, we've added another observer to the list. Since the loop expression evaluates the array length each time, the list is able to expand while its being evaluated.

-=Cliff>