Created
November 23, 2011 18:17
-
-
Save getify/1389431 to your computer and use it in GitHub Desktop.
showing how i use $LAB in my pages -- aka, best-practice recommendation
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
<!DOCTYPE html> | |
<html> | |
<head>...</head> | |
<body> | |
... | |
<script src="load.js"></script> | |
</body> | |
</html> |
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
/* ****** inline LAB.js here ****** */ | |
// now, include your $LAB chains | |
$LAB.script(".../facebook.js").wait(function(){ | |
// facebook init | |
}); | |
$LAB.script(".../ga.js").wait(function(){ | |
// ga init | |
}); | |
$LAB.script(...).wait(...).script(...); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I always recommend inlining LAB.js into a file called "load.js" (or whatever), and then including all your $LAB chains for loading all the rest of your files. You can even do things like call a setTimeout(), or listen for a window.onload(), before calling other $LAB.script()s.