Skip to content

Instantly share code, notes, and snippets.

@shubhendusaurabh
Created January 12, 2015 11:42
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 shubhendusaurabh/0286d7059b5bfb971e02 to your computer and use it in GitHub Desktop.
Save shubhendusaurabh/0286d7059b5bfb971e02 to your computer and use it in GitHub Desktop.
A Replacement for the setTimeout Function
function wait(timeout){
var deferred = $.Deferred();
setTimeout(deferred.resolve, timeout);
return deferred.promise();
}
wait(500).done(function(){
console.log('Timeout fired!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment