Skip to content

Instantly share code, notes, and snippets.

@minimal
Created January 19, 2010 17:37
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 minimal/281112 to your computer and use it in GitHub Desktop.
Save minimal/281112 to your computer and use it in GitHub Desktop.
success: function (data) {
//called when successful
if (data.length) {
// $.each(data, function (i, msg) {
// msg = $('<p/>').haml(message(msg)).html()
// $(msg).insertAfter('.queue_title')
// .animate({height: "toggle"}, 0).animate({height: "toggle"}, {queue: true});
// });
function make_caller_with_tail(msgs) {
var tail = msgs.slice(1);
return function() {
addmsgs(tail);
}
}
function addmsgs(msgs) {
if (msgs.length === 0) {
return
}
msg = $('<p/>').haml(message(msgs[0])).html()
$(msg).insertAfter('.queue_title')
.animate({height: "toggle"}, 0).animate({height: "toggle"}, make_caller_with_tail(msgs));
}
addmsgs(data);
prettyPrint();
//console.log("got data");
retry('reset');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment