Created
October 6, 2016 17:31
-
-
Save sibelius/2142604dad92c92e9198380860d12098 to your computer and use it in GitHub Desktop.
Promise.all limit
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
let start = 0; | |
const limit = 10; | |
items.slice(start, limit).forEach(subset => | |
await Promise.all(subset.map(async (item) => { | |
// do async work with a single item | |
})) | |
.then(() => (start += limit) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment