slavka1979
slavka1979
Reputation Top 5%
slavka1979 udo
1 Snippet  (748th place)
Published
1 Channel
Created
2 Channels
Following
May 26, 2017
Last Visit
May 26, 2017
Registered
40 points  (578th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Popular Coder
Junior Autobiographer
Senior Autobiographer

Recent Snippets See all snippets by slavka1979

public by slavka1979 created May 26, 2017  211  1  5  0

Promise.all for Rejections and Resolves

Always call then, even when one promise rejects
// https://davidwalsh.name/promises-results
Promise.all([
    // Resolves
    Promise.resolve(1), 
    // Rejects after 2 seconds
    new Promise((resolve, reject) => setTimeout(() => reject(1), 2000))
].map(p => p.catch(() => undefined))).then(() => console.log('done!'));
;