Skip to content

Instantly share code, notes, and snippets.

@sethlivingston
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethlivingston/e3d568c401811cf95b92 to your computer and use it in GitHub Desktop.
Save sethlivingston/e3d568c401811cf95b92 to your computer and use it in GitHub Desktop.
Workflow.run = function (actions) {
var files = [];
var promise = Promise.resolve(files);
actions.forEach(function(action) {
promise = promise.then(function (outFiles) {
// Need to return a promise here to keep the chain going
return new Action(action, outFiles);
});
});
promise = promise.catch(function (error) {
// Do something here
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment