Skip to content

Instantly share code, notes, and snippets.

@dkstevekwak
Created March 7, 2018 16:21
Show Gist options
  • Select an option

  • Save dkstevekwak/87710e39d15db2f8114e7e235f510d9b to your computer and use it in GitHub Desktop.

Select an option

Save dkstevekwak/87710e39d15db2f8114e7e235f510d9b to your computer and use it in GitHub Desktop.
/* Using Promise.all to execute multiple async functions simultaneously */
Promise.all([runEvalScript('firstTask()'), runEvalScript('secondTask()'), runEvalScript('thirdTask()')])
.then(function(result) {
//result is an array of values resulted from the three fulfilled promises.
})
.catch(function(error) {
//Triggers if at least one of the promises were rejected.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment