Created
January 6, 2016 15:19
-
-
Save arturom/3140250c988ff7310102 to your computer and use it in GitHub Desktop.
This file contains 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 characters
function importLodash() { | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.src = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js'; | |
document.body.appendChild(s); | |
} | |
function toURL(id) { | |
return '/test/reprocess_asset/' + id; | |
} | |
function toAjaxPromise(url) { | |
return $.get(url); | |
} | |
var ids, promises, responses; | |
importLodash(); | |
ids = [4810627,4810545,4810622]; | |
promises = _(ids) | |
.map(toURL) | |
.map(toAjaxPromise) | |
.value(); | |
responses = _(promises) | |
.pluck('responseText') | |
.map(JSON.parse) | |
.value(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment