Created
November 16, 2016 09:26
-
-
Save webpapaya/3343d3bf990317cd0a1fa9776b0a8c5b 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
const queue = new PromiseQueue(); | |
const anotherTask = () => { /* do something fancy */ }; | |
const errorTask = () => { /* do something fancy */ }; | |
const myApiCall1 = () => Promise.resolve() | |
.then(() => { queue.push(anotherTask) }) | |
.catch(() => { queue.push(errorTask) }) | |
queue.resolve().then((results) => { | |
console.log(results); | |
}).catch((error) => { | |
console.log(error); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment