src/loadjs.js
function loadFiles(paths, callbackFn, args) {
  // listify paths
  paths = paths.push ? paths : [paths];

  var numWaiting = paths.length,
      x = numWaiting,
      pathsNotFound = [],
      fn,
      i;

  // define callback function
  fn = function(path, result, defaultPrevented) {
    // handle error
    if (result == 'e') pathsNotFound.push(path);

    // handle beforeload event. If defaultPrevented then that means the load
    // will be blocked (ex. Ghostery/ABP on Safari)
    if (result == 'b') {
      if (defaultPrevented) pathsNotFound.push(path);
      else return;
    }

    numWaiting--;
    if (!numWaiting) callbackFn(pathsNotFound);
  };

  // load scripts
  for (i=0; i < x; i++) loadFile(paths[i], fn, args);
}
function loadFiles(paths, callbackFn, args) {
  // listify paths
  paths = paths.push ? paths : [paths];

  var numWaiting = paths.length,
      x = numWaiting,
      pathsNotFound = [],
      fn,
      i;

  // define callback function
  fn = function(path, result, defaultPrevented) {
    // handle error
    if (result == 'e') pathsNotFound.push(path);

    // handle beforeload event. If defaultPrevented then that means the load
    // will be blocked (ex. Ghostery/ABP on Safari)
    if (result == 'b') {
      if (defaultPrevented) pathsNotFound.push(path);
      else return;
    }

    numWaiting--;
    if (!numWaiting) callbackFn(pathsNotFound);
  };

  // load scripts
  for (i=0; i < x; i++) loadFile(paths[i], fn, args);
}
function loadFiles ( paths , callbackFn , args ) { // listify paths paths = paths . push ? paths : [ paths ] ; var numWaiting = paths . length , x = numWaiting , pathsNotFound = [ ] , fn , i ; // define callback function fn = function ( path , result , defaultPrevented ) { // handle error if ( result == 'e' ) pathsNotFound . push ( path ) ; // handle beforeload event. If defaultPrevented then that means the load // will be blocked (ex. Ghostery/ABP on Safari) if ( result == 'b' ) { if ( defaultPrevented ) pathsNotFound . push ( path ) ; else return ; } numWaiting -- ; if ( ! numWaiting ) callbackFn ( pathsNotFound ) ; } ; // load scripts for ( i = 0 ; i < x ; i ++ ) loadFile ( paths [ i ] , fn , args ) ; }
Load multiple files.
@param {string[]} paths - The file paths
@param {Function} callbackFn - The callback function
Load multiple files .