Author: Lin Dong
Demo: JSfiddle
let r = Promise.resolve();
urls.forEach((url) => {
r = r.then(() => {
return $.get(url);
});
});
https://medium.com/@kbrainwave/currying-in-javascript-ce6da2d324fe#.n9p9nzbj6
https://html5hive.org/how-to-chain-javascript-promises/ http://hellote.com/dynamic-promise-chains/
http://javascriptplayground.com/blog/2015/02/promises/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators https://github.com/shama/letswritecode/blob/master/javascript-generators/index.js http://alexperry.io/javascript/2015/09/17/es6-generators-and-asynchronous-javascript.html http://www.2ality.com/2015/11/sequential-execution.html
http://blog.carbonfive.com/2015/01/29/composing-synchronous-and-asynchronous-functions-in-javascript/ https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html https://www.sitepoint.com/six-things-might-know-promises/ http://stackoverflow.com/questions/20100245/how-can-i-execute-array-of-promises-in-sequential-order http://www.datchley.name/promise-patterns-anti-patterns/ http://bhashitparikh.com/2014/06/04/better-jquery-ajax-with-es6-generators.html
[Good] http://www.javascriptkit.com/javatutors/javascriptpromises.shtml