Skip to content

Instantly share code, notes, and snippets.

@FTAndy
Created November 2, 2016 15:16
Show Gist options
  • Save FTAndy/7a2b88963fc4c7a5e834cefc44b1ac75 to your computer and use it in GitHub Desktop.
Save FTAndy/7a2b88963fc4c7a5e834cefc44b1ac75 to your computer and use it in GitHub Desktop.
Promise synchronize array promises
let results = []
dataArray.reduce((prePromise, data) => {
return prePromise.then(() => {
return dosomethingWithData(data)
.then((result) => {
results.push(result)
})
})
}, Promise.resolve())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment