/ensure-demo.js Secret
Created
May 29, 2015 14:19
Ensure Sample
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
$(document).ensure(function() { | |
return $("p.test").exists(); | |
}).done(function() { | |
console.log("p.test exisits."); | |
}); | |
$("body").ensure(function() { | |
return $("a", this).exists(); | |
}).done(function(self) { | |
$("a", self).toggle(); | |
}); | |
$(selector).ensure({ | |
delay: 500, | |
tries: 0, | |
isValid: function() { | |
return $(this).is(".loaded"); | |
} | |
}).done(function(self) { | |
console.log("done loading resource"); | |
}).fail(function() { | |
console.log("failed to load resource"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment