-
-
Save joelnet/b286721a933e7e410120a8a2866dbcc8 to your computer and use it in GitHub Desktop.
Revisions
-
joelnet revised this gist
Aug 17, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,5 +21,5 @@ const funcs = urls.map(url => () => $.ajax(url)) // execute Promises in serial promiseSerial(funcs) .then(console.log.bind(console)) .catch(console.error.bind(console)) -
joelnet revised this gist
Jan 5, 2017 . 2 changed files with 13 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,18 @@ * .then(console.log) * .catch(console.error) */ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) // some url's to resolve const urls = ['/url1', '/url2', '/url3'] // convert each url to a function that returns a promise const funcs = urls.map(url => () => $.ajax(url)) // execute Promises in serial promiseSerial(funcs) .then(console.log) .catch(console.error) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +0,0 @@ -
joelnet renamed this gist
Jan 4, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
joelnet revised this gist
Jan 4, 2017 . 2 changed files with 15 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,4 @@ import { promiseSerial} from './promiseSerial' // some url's to resolve const urls = ['/url1', '/url2', '/url3'] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ /* * promiseSerial resolves Promises sequentially. * @example * const urls = ['/url1', '/url2', '/url3'] * const funcs = urls.map(url => () => $.ajax(url)) * * promiseSerial(funcs) * .then(console.log) * .catch(console.error) */ export const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,13 @@ /* * promiseSerial resolves Promises sequentially. * @example * const urls = ['/url1', '/url2', '/url3'] * const funcs = urls.map(url => () => $.ajax(url)) * * promiseSerial(funcs) * .then(console.log) * .catch(console.error) */ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +0,0 @@ -
joelnet revised this gist
Jan 4, 2017 . 2 changed files with 17 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ // execute promises in serial. const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) // some url's to resolve const urls = ['/url1', '/url2', '/url3'] // convert each url to a function that returns a promise const funcs = urls.map(url => () => $.ajax(url)) // execute Promises in serial promiseSerial(funcs) .then(console.log) .catch(console.error) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,4 @@ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ // execute promises in serial. const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) // some url's to resolve const urls = ['/url1', '/url2', '/url3'] // convert each url to a function that returns a promise const funcs = urls.map(url => () => $.ajax(url)) // execute Promises in serial promiseSerial(funcs) .then(console.log) -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,9 +4,7 @@ const urls = ['/url1', '/url2', '/url3'] // convert each url to a function that returns a promise const funcs = urls.map(url => () => $.ajax(url)) // execute promises in serial. const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,18 @@ // some url's to resolve const urls = ['/url1', '/url2', '/url3'] // convert each url to a function that returns a promise const funcs = urls.map(url => () => $.ajax(url)) /* * Execute promises in serial. */ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) // execute Promises in serial promiseSerial(funcs) .then(console.log) .catch(console.error) -
joelnet revised this gist
Jan 4, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([])) -
joelnet created this gist
Jan 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ const promiseSerial = funcs => funcs.reduce((promise, func) => promise.then(result => func().then(Array.prototype.concat.bind(result))), Promise.resolve([]))