Created
June 1, 2010 12:26
-
-
Save assertchris/420885 to your computer and use it in GitHub Desktop.
JavaScript Function.prototype.when method
This file contains hidden or 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.prototype.when = function(check, interval, bind) | |
{ | |
var bind = bind || this, | |
timer = setInterval(function() { | |
if (check.apply(bind)) | |
{ | |
clearInterval(timer); | |
this.apply(bind); | |
} | |
}, (interval || 100)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment