Skip to content

Instantly share code, notes, and snippets.

@getify
Created November 23, 2011 18:17
Show Gist options
  • Save getify/1389431 to your computer and use it in GitHub Desktop.
Save getify/1389431 to your computer and use it in GitHub Desktop.
showing how i use $LAB in my pages -- aka, best-practice recommendation
<!DOCTYPE html>
<html>
<head>...</head>
<body>
...
<script src="load.js"></script>
</body>
</html>
/* ****** 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(...);
// ...
@getify
Copy link
Author

getify commented Nov 23, 2011

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment