Skip to content

Instantly share code, notes, and snippets.

@zapthedingbat
Created July 30, 2014 13:10
Show Gist options
  • Save zapthedingbat/d32a8fb26913207aeb4d to your computer and use it in GitHub Desktop.
Save zapthedingbat/d32a8fb26913207aeb4d to your computer and use it in GitHub Desktop.
jquery method returns a function that returns a promise that resolves when all the promises returned by specified functions resolve/reject
function wait(/* functions returning promises*/) {
return (function() {
return $.when.apply($, Array.prototype.map.call(actions, function(a) { return a(); }));
}).bind(Array.prototype.slice.call(arguments));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment