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: Chain Commands that Don't Execute Until Previous Command Does  (Read 3535 times)
codecraig
Full Member
***
Posts: 23


View Profile Email
« on: September 09, 2008, 08:38:55 »

I have a MacroCommand and it executes Command A, B, then C.  Currently B needs some data that A gets to do it's function.  However, A calls a remote object asynchronously so it's 'execute' method finishes quickly and the MacroCommand calls B.execute. 

Should I implement something that causes MacroCommand to wait for A to "finish" before calling B?  or Should I create a special Proxy that stores the temporary results for me?

Thanks!
Logged
codecraig
Full Member
***
Posts: 23


View Profile Email
« Reply #1 on: September 09, 2008, 10:13:06 »

My approach right now is to create my MacroCommand type of class that will pass a "finishedCallback" to each command before calling "execute" on it.  Then it sits until a command finishes, then calls the next one.  My subcommands actually modify the body of the notification as they move along.

works for me...anyone else try this?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: September 10, 2008, 04:38:16 »

Have a look at Trilec's Notification Chaining utility:

http://forums.puremvc.org/index.php?topic=422.0

-=Cliff>
Logged
Pages: [1]
Print