Skip to content

Instantly share code, notes, and snippets.

@minedun6
Created May 2, 2019 07:54
Show Gist options
  • Save minedun6/8be485dd110857a66999764dc4d1b41d to your computer and use it in GitHub Desktop.
Save minedun6/8be485dd110857a66999764dc4d1b41d to your computer and use it in GitHub Desktop.
I just shipped Promise.allSettled in Chrome 76
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