Created
September 8, 2017 07:43
-
-
Save tygas/93db2a22d77e10843cb53cf235e5b02f to your computer and use it in GitHub Desktop.
This file contains 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
let r; | |
const runTasks = (...tasks) => Promise.all(tasks.map(t => t())).then(r => (r)); | |
const tA = () => new Promise(r => setTimeout(() => r('A'), 1000)); | |
const tB = () => new Promise(r => setTimeout(() => r('B'), 100)); | |
const tC = () => new Promise(r => setTimeout(() => r('C'), 100)); | |
runTasks(tA, tB, tC).then(re => { | |
console.log(re); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment