PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: codecraig on September 09, 2008, 08:38:55



Title: Chain Commands that Don't Execute Until Previous Command Does
Post by: codecraig 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!


Title: Re: Chain Commands that Don't Execute Until Previous Command Does
Post by: codecraig 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?


Title: Re: Chain Commands that Don't Execute Until Previous Command Does
Post by: puremvc 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>