Setting up dependencies with head.js

Setting up dependencies with head.js

I was looking for some users that have experience with the jQuery plugin head.js

According to the website, head.js allows you to setup js/css file dependencies and load js files asyncronously and in parallel.

Looking at the API documentation and examples, I see that you can apply labels to JS files, then run some conditions when they are loaded, heres an example in their documentation:
  1. // same as above, but pass files in as an Array
    head.load([
    { label1: "file1.js" },
    { label2: "file2.js" }],
    function() {
    // do something
    });

    // Labels are usually used in conjuntion with: head.ready()
    head.ready("label1", function() {
    // do something
    });

So basically, that will execute anything in the 2nd block of code (inside the closure), when the file1.js is loaded.

What I wanted to do, is load more files (asyncronously) when other files are loaded..

For example..

First, load the jquery file
  1. jquery.min.js
Then once thats done, load the datatables files that are dependent on jquery (asyncronously)
  
  1. dataTables.searchHighlight.min.js
  2. dataTables.conditionalPaging.js
  3. ellipsis.js
  4. jquery.dataTables.yadcf.js
Then once thats done, load the app files that are dependent on DataTables files
  1. myapp_core.js
  2. myapp_whatever.js

How would I do this with Head.js? The documentation isnt super clear. the head.ready() looks at one file/label to make sure it loaded successfully, how would you do multiple?

And to have others load after that one is done, would you just put another head.load() inside the closure statement inside the head.ready()?