Skip to content

Instantly share code, notes, and snippets.

@veltman
Created May 29, 2014 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veltman/fcb6d1bd7aed8438aeff to your computer and use it in GitHub Desktop.
Save veltman/fcb6d1bd7aed8438aeff to your computer and use it in GitHub Desktop.
queue()
.defer(getJSON,"new-york.json")
.defer(getJSON,"chicago.json")
.defer(getJSON,"miami.json")
.awaitAll(function(error,cities) {
//Cities will be an array of cities, in order
});
function getJSON(url,cb) {
$.getJSON(url,function(data) {
cb(null,data);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment