I've looked at the ChainNotifier
http://forums.puremvc.org/index.php?topic=422.0 but its not necessarily what I expected. I've been wanting an approach that follows more the PureMVC flow, API... not sure what word I'm looking for here. Looking for something that feels PureMVCish.
@cliff, @binarycrafts
I think I have an idea that will solve some of your concerns that you mentioned in the ChainNotifier utility topic (link above).
I envision say.. an AsyncMarcoCommand, that would implement ICommand and INotifier that you call addSubCommand for each asynchronous command you wanted fired in order. Now before you all cry foul let me explain the handling for these sub commands!
Using something similar to the ChainNotifier, the AsyncMacroCommand would add each sub command to an instance of a AsyncCommandMediator (I can't think of a better name at the moment so don't get to caught up on this one!). This is crucial since Cliff makes a good point that the mediator after being registered will have to be de-registered.
How to handle the de-registration? Well with each addSubCommand call you would add in the notification it sends on complete. The AsyncCommandMediator would know (since its listening for all those notifications) when the last notification fires thus being able to remove itself from the framework.
What does this solve?
1. The command won't have state! Yay!
2. Since a mediator is registered it will handle removing itself from the framework when its done
3. Every time you issue a new AsyncMacroCommand it will always register a new instance of AsyncCommandMediator (and safely deregister when all commands are completed)
4. Sticks to the API the PureMVC framework provides for sequencing commands (only now it works with async ones!)
5. Provides a map.. an easy to read sequence of the commands being fired in one place. No more having to go search for each sendNotification call that triggers the next command. Woo hoo!
Brainstorming this just now what do you guys think? Would something like this work? Say the word and R&D will begin!