Javascript Promises

javascript

https://gist.github.com/nhagen/a1d36b39977822c224b8
https://stackoverflow.com/questions/31424561/wait-until-all-es6-promises-complete-even-rejected-promises
https://medium.com/@bluepnume/learn-about-promises-before-you-start-using-async-await-eb148164a9c8
https://daveceddia.com/waiting-for-promises-in-a-loop/
https://coderwall.com/p/ijy61g/promise-chains-with-node-js

https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html
https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred
http://blog.mediumequalsmessage.com/promise-deferred-objects-in-javascript-pt1-theory-and-semantics
https://stackoverflow.com/questions/6801283/what-are-the-differences-between-deferred-promise-and-future-in-javascript
http://lucybain.com/blog/2016/js-promises-vs-deferred/

https://promisesaplus.com/
http://wiki.commonjs.org/wiki/Promises/A
https://www.sitepoint.com/overview-javascript-promises/ - printed
https://stackoverflow.com/questions/22707475/how-to-make-a-promise-from-settimeout - printed
https://www.theguardian.com/info/developer-blog/2014/dec/10/taming-timeouts-with-a-promise - printed
https://italonascimento.github.io/applying-a-timeout-to-your-promises/ - printed
https://blog.raananweber.com/2015/12/01/writing-a-promise-delayer/ - printed
https://davidwalsh.name/promises - printed
http://www.datchley.name/es6-promises/ - printed
https://esdiscuss.org/topic/promise-cast-and-promise-resolve
https://www.sitepoint.com/deeper-dive-javascript-promises/

What is a promise?
Chaining
Special case 1 / setTimeout
How can we use Promise.all(iteratable)?
How can we use Promise.race(iteratable)
Using promises to tame setTimeout
How can we timeout a promise?
How can we delay execution of the next promise in a chain?

  1. What happens if we have an existing promise and we pass this promise to Promise.resolve or Promise.reject? Will it resolve or reject the original promise? My guess is that it will not resolve or reject the original promise, but what will happens to all those then callbacks or catch callbacks?
  2. Promise.all returns a promise that is rejected as soon as one of the promises is rejected. If we need to waits for all promises to be either resolved or rejected, how can we do this?
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License