path list as a array #139

sjoonk opened this Issue May 13, 2011 · 5 comments


None yet

5 participants

sjoonk commented May 13, 2011

I'd like to change the path list of head.js method.
Is there any way to pass the path list as an array??


I'm just testing this on a large project and found the following method works for loading in parallel and executing in sequence:

//Create or generate an array of scripts
var scripts = ['Includes/error.js', /adapter/ext/ext-base.js', '/Components/cmpBase.js'];

//Use Javascript's apply method to call the head.js function
head.js.apply(window, scripts);

Hope this helps someone.


Wishing we could pass in an array, that'd be really useful.

The .apply work-around doesn't make for easy callback handling


will give this some more thought.

The apply example would look like this more likely with a callback

head.js.apply(window, scripts.push(callback));

I wrote a quick workaround for my own purposes for now, nothing fancy:

var args      = arguments,
     callback = args[args.length - 1],
     items    = {};

if (!isFunction(callback)) {
    callback = null;

 if (isArray(args[0])) {
    var arrArgs = args[0];
    args = [];
    each(arrARgs, function (arg) {

Shipping in 1.0.0

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