lundi 4 juillet 2016

When to use promise.all()?

This is more of a conceptual question. I understand the Promise design pattern, but couldn't find a reliable source to answer my question about promise.all():

What is(are) the correct scenario(s) to use promise.all()

OR

Are there any best practices to use promise.all()? Should it be ideally used only if all of the promise objects are of the same or similar types?

The only one I could think of is:

  • Use promise.all() if you want to resolve the promise only if all of the promise objects resolve and reject if even one rejects.

Aucun commentaire:

Enregistrer un commentaire