Permalink
Browse files

Initial check-in

  • Loading branch information...
1 parent cd14116 commit 922ba37972b8faae15cd0f9d8120270d2609fc92 @MoonScript committed Mar 1, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 jquery.wait.js
View
@@ -0,0 +1,9 @@
+// Wrap setTimeout in a Deferred
+$.wait = function(delay){
+ var deferred = $.Deferred();
+ var timer = setTimeout(deferred.resolve, delay);
+ deferred.fail(function(){
+ clearTimeout(timer);
+ });
+ return deferred;
+};

0 comments on commit 922ba37

Please sign in to comment.