Created
March 7, 2018 16:21
-
-
Save dkstevekwak/87710e39d15db2f8114e7e235f510d9b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* 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