Created
May 2, 2019 07:54
-
-
Save minedun6/8be485dd110857a66999764dc4d1b41d to your computer and use it in GitHub Desktop.
I just shipped Promise.allSettled in Chrome 76
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 promises = [ | |
fetch('/api-call-1'), | |
fetch('/api-call-2') | |
]; | |
// Imagine some of these requests fail, and some succeed. | |
const results = await Promise.allSetted(promises); | |
// [ | |
// {status: "fulfiled", value: Response} | |
// {status: "rejected", value: typeError: Failed to fetch} | |
//] | |
// Now, all API calls have finished (either failed or succeeded). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment