Skip to content

tomnewton/PureMVC-AsyncCommand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

PureMVC-AsyncCommand Objective-C

An AsyncMacroCommand and AsyncCommand for use with the PureMVC framework.

Dependencies

Usage

Example:

Subclass the AsyncMacroCommand, and override the initializeAsyncMacroCommand method. Add any SimpleCommands or commands which implement the IAsyncCommand protocol like so:


-(void)initializeAsyncMacroCommand{
	
	[self addSubCommand:[CommandOne class]];
	[self addSubCommand:[CommandTwo class]];
	[self addSubCommand:[CommandThree class]];

}

When the AsyncMacroCommand is invoked, it executes the subcommands in the order they were added. The manner in which they are executed is dependent on whether or not they have implement the IAsyncCommand protocol. So if CommandOne and CommandThree implement the IAsyncCommand protocol, and Command Two does not, execution is as follows:

  • CommandOne is executed
  • Only when CommandOne is finished and calls [self.onCompleteDelegate commandComplete] will CommandTwo execute
  • CommandThree will execute immediately without waiting for a callback from CommandTwo since CommandTwo is a SimpleCommand.

Likewise, if you add multiple AsyncCommands one after another, the execution will follow a similar pattern, ensuring that a command is not executed until the preceding command is complete. This can be very useful when you need to make multiple dependent calls to a server, or orchestrate some other sequence of events.

About

An Objective-c implementation of PureMVC AsyncCommand and AsyncMacroCommand.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published