PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: schickm on July 15, 2008, 08:21:17



Title: Notifications - syncronous or asyncronous?
Post by: schickm on July 15, 2008, 08:21:17
Lets say I'm dispatching two notifications in a row, for example:

:
sendNotification( ApplicationFacade.BUILD_CAR );
sendNotification( ApplicationFacade.START_CAR );

Can I be confident that every Controller and Mediator that responds to BUILD_CAR will be finished executing before the START_CAR notification is sent?

If I only had Controllers responding to these notifications then naturally I would use a MacroCommand, but I also have mediators that are responding too. Regardless, should I even be writing code that is dependent on sequential execution like this?


Title: Re: Notifications - syncronous or asyncronous?
Post by: puremvc on July 15, 2008, 04:18:33
Flash is single threaded, so if you're using the Flash platform, then as long as the notified observers don't do anything async (i.e. A timer or service call, or a flex view related operation where flex internally calls the callLater method) then yes, the code should execute synchronously, completing all the code for each observer's response before getting to the next line of code.

-=Cliff>


Title: Re: Notifications - syncronous or asyncronous?
Post by: schickm on July 15, 2008, 06:12:21
Cool beans!  Thanks for the quick reply Cliff.  Your framework is a shining star in sky filled with poorly implemented asteroids.


Title: Re: Notifications - syncronous or asyncronous?
Post by: Lothiack on August 04, 2008, 01:43:25
I had the same question.
Good that I searched before asking.  ;D