Skip to content

Instantly share code, notes, and snippets.

@hampelm
Created August 23, 2012 02:49
Show Gist options
  • Save hampelm/3431618 to your computer and use it in GitHub Desktop.
Save hampelm/3431618 to your computer and use it in GitHub Desktop.
function code(geocoder, locations) {
setTimeout(function() {
geocoder(locations[0]);
console.log(locations[0]);
locations.shift();
if(locations.length !== 0) {
code(geocoder, locations);
}
}, 1000);
}
_.each(geocoders, function(gc) {
code(_.clone(gc, locations))
});
@prashtx
Copy link

prashtx commented Aug 23, 2012

var delay = 1000;
var funs = [f1, f2];
funs.reduceRight(function (memo, f) {
  setTimeout(f, memo);
  return memo + delay;
}, 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment