Created
January 12, 2015 11:42
-
-
Save shubhendusaurabh/0286d7059b5bfb971e02 to your computer and use it in GitHub Desktop.
A Replacement for the setTimeout Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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