The Promise object has many useful functions like all, resolve, reject, and race — stuff we use all the time. One function that many don’t know about is Promise.allSettled, a function that fires when all promises in an array are settled, regardless of whether any of the promises are resolved or rejected.
Promise.all is great but then isn’t called if a project is rejected:
Promise.all([
Promise.resolve(1),
Promise.resolve(true),
Promise.reject("Boooooo"),
])
.then(_ => console.log("Then!"))
.catch(e => console.
from Proven Ways https://ift.tt/2XoAJ77
Comments
Post a Comment