Last active
February 4, 2017 13:04
-
-
Save abiodun0/f3259f1cf0e1b0f3a2051b7378525c7e 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
function promiseFn(id) { | |
// replace this with your axios function, this is an asyn simulator | |
return new Promise(function(resolve, reject){ | |
setTimeout(()=> resolve(id), 2000); | |
}); | |
} | |
let makePromises = (result) => result.map(promiseFn); | |
Promise.all(makePromises([1,2,3,4,5])).then(function(r){ | |
console.log(r) | |
throw new Error('Abiodun is a stupid guy') | |
}).catch(err => console.log('bleer',err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment