Created
February 29, 2016 22:39
-
-
Save Kyle-Muir/a2cac3c4f13c6919a5e3 to your computer and use it in GitHub Desktop.
AngularJS\Typescript - Synchronously execute promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private synchronouslyExecuteCommands = (commands: Array<IProductModificationCommand>, product: Model.Product): ng.IPromise<any> => { | |
var commandPromises = this.$q.when(); | |
_.each(commands, (command: IProductModificationCommand) => { | |
commandPromises = commandPromises.then(() => { | |
return command.execute(product); | |
}); | |
}); | |
return commandPromises; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment