JAL – Just Another Loader for JavaScript

$loader
.load('js/jquery.min.js')
.done(function(){
    // Stop jQuery from triggering the "ready" event
    $.holdReady(true)
})
.load([
      'js/script-one.min.js'
    , 'js/script-two.min.js'
])
.ready(function() {
    // Allow jQuery to trigger the "ready" event
    $.holdReady(false)
    // Start app
});

We tested YepNope, which is a great loader, but felt it could be faster. It also had features we didn’t really need. So we wrote our own. We reinvented the wheel. How hard could it be? Well, it was pretty hard.

What we needed was a resource loader that could load, not only JavaScript but stylesheets as well. It also needed to be able to load resources in parallel and in groups to handle dependencies, such as loading jQuery before loading a jQuery plugin. The final requirement was conditional loading, i.e. load JSON.js if the browser is lacking native JSON support.

JAL Source (GitHub) →
JAL – Just Another Loader for JavaScript →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.