Hello ! 🧑🌾
Promises are available since ES2015 to simplify the handling of asynchronous operations.
Let's discover 2 Promises and their differe...
For further actions, you may consider blocking this person and/or reporting abuse
This is a really handy,
allSettled
has more verbose outputThanks for sharing @viclafouch .
Loved the article
Thank you @iarmankhan ;)
You can as well do the following to stop Promise.all from rejecting if there is an exception thrown.``
`
let storage = {
updated: 0,
published: 0,
error: 0,
};
let p1 = async (name) => {
let status = {
success: true,
error: false,
};
return status;
};
let p2 = async (name) => {
throw new Error('on purpose');
};
let success = () => {
storage.updated += 1;
};
let logError = (error) => {
console.log(error.message);
storage.error += 1;
};
Promise.all([
p1('shobe 1').then(success).catch(logError),
p2('shobe 2').then(success).catch(logError),
p1('shobe 1').then(success).catch(logError),
]).then(() => {
console.log('done');
});
`
Thanks for sharing this post!
Whoa! I had no idea this existed. Thanks for the helpful write-up!
A pleasure @polluterofminds ;)
I'd love some elaboration on why allSettled was made/why it's better
github.com/tc39/proposal-promise-a...
How can I use Promise.allSettled() with my webpack-react app? Is there any plugin being used for it?
Very well explained. Thank you so much Victor.
short and nice!
Helpful bro, thnx !!!