Skip to content

Instantly share code, notes, and snippets.

@icholy
Created May 15, 2013 14:09
Show Gist options
  • Save icholy/5584249 to your computer and use it in GitHub Desktop.
Save icholy/5584249 to your computer and use it in GitHub Desktop.
var loop = function (fn) {
var next = function () { setTimeout(recur, 0); };
var recur = function () { fn(next); };
recur();
};
loop(function (next) {
something_async(function (data) {
// ...
next();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment