Created
June 27, 2011 13:45
-
-
Save getify/1048881 to your computer and use it in GitHub Desktop.
how to not miss window.onload in dynamic script loading case
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
<html> | |
<head> | |
<script src="LAB.js"></script> | |
... | |
<script> | |
function do_something() { /* ... */ } | |
(function(){ | |
var _winload = false; | |
window.onload = function(){ _winload = true; }; | |
$LAB | |
.script(...) | |
.script(...) | |
.wait(function(){ | |
if (_winload) do_something(); | |
else window.onload = do_something; | |
}); | |
})(); | |
</script> | |
... | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment