ajmorgan
10/13/2016 - 4:05 AM

promise chain

promise chain

["file1", "file2", "file3"]
.map(getFile) // getFile returns a promise
.reduce(
  function(chain, filePromise) {
    return 
    chain.then(function() {
      return filePromise;
    })
    .then(output);
  },
  Promis.Resolve()
  )
  .then(function() {
    output("Complete!");
  });