Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Notifications - syncronous or asyncronous?  (Read 8059 times)
schickm
Newbie
*
Posts: 9


View Profile Email
« 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?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
schickm
Newbie
*
Posts: 9


View Profile Email
« Reply #2 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.
Logged
Lothiack


Email
« Reply #3 on: August 04, 2008, 01:43:25 »

I had the same question.
Good that I searched before asking.  ;D
Logged
Pages: [1]
Print