Skip to content

Instantly share code, notes, and snippets.

@justinobney
Created March 28, 2013 14:45
Show Gist options
  • Select an option

  • Save justinobney/5263690 to your computer and use it in GitHub Desktop.

Select an option

Save justinobney/5263690 to your computer and use it in GitHub Desktop.
A more expressive setTimeout
$.wait = function(time) {
return $.Deferred(function(dfd) {
setTimeout(dfd.resolve, time);
}).promise();
};
/*
----------------------------
Use Case
----------------------------
$.wait(1000).then(function(){
// Do some work...
});
----------------------------
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment