Just started looking at asynchronous javascript loading libs such as lab.js and script.js. My question is about best practises for using this type of async loading pattern.
I've thought of a couple possible setups:
Load the async loader at the top or the page with a script tag. This allows for gzipping and caching, but it also blocks during this initial load. This is likely not a huge deal as these loaders are supposed to be fairly small (should we load css first still) ?
Have the async loader code inline in your html, then start using immediately to load dependencies. This means there's no separate request for the async loader so it's likely a bit faster, but it also doesn't get gzipped and cached, so it has to get loaded each time.
Do the classic load of JS at the bottom of the page so stylesheets etc are loaded first. Place async loader in blocking script tag at the bottom of the page, then load all dependencies asynchronously.
What is the most used scenario, how do people normally load their js asynchronously ??