Monday, November 30th, 2009
We have posted about LABjs before, the library that aims to be able to effectively load any script resource(s), from any location, into any page, at any time. It loads them all as parallel as the browser will allow, but maintains execution order when you express the need to do so in the usage of the API, for keeping dependencies safe.
At JSConf.EU in Berlin, I saw Steve Souders and Kyle Simpson riffing on how to make LABjs follow the research that Steve (in his newest book) and Kyle have done.
There were issues in the past, but we now have a new release of LABjs that does the right thing, as long as you
Give it a whirl, and read the full post for details on performance and issues with flashing in before behaviour has been added… which leads us to the cavaet on jQuery and DOM ready.
Also, if you think that you should be just concat’ing all of the files into one, see why Kyle thinks you should potentially think again.
As I wrote this another library called NBL came in from “Berklee”. He told us:
It’s called NBL and comes down to 1187 bytes minified. It runs stand-alone and has several options that I could not find in any other library:
2. You can provide a callback function that fires when all scripts are loaded, or if you use jQuery, the callback will be fired by jQuery’s document.ready() function (unless the page finishes before jQuery initialises, in which case it fires when all scripts are loaded).
3. In case of network latency (or faulty urls), NBL will fire the callback function after a timeout (by default 1200ms).
4. It does not need to be called, it can be configured completely from the script tag itself, like this:HTML4< view plain text >
- plugins: [ 'jquery.lightbox.min.js', 'jquery.carousel.min.js' ], ready: my_ready_function }" />
Posted by Dion Almaer at 6:32 am