Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created June 1, 2010 12:19
Show Gist options
  • Save assertchris/420871 to your computer and use it in GitHub Desktop.
Save assertchris/420871 to your computer and use it in GitHub Desktop.
MooTools when method
Function.implement({
'when': function(check, interval, bind)
{
var bind = bind || this,
timer = setInterval(function() {
if (check.apply(bind))
{
clearInterval(timer);
this.apply(bind);
}
}.bind(bind), (interval || 100));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment