Load and execute a set of JavaScript source files.

This method is defined as a JavaScript function.
325557
public static void load(Context cx, Scriptable thisObj,
                            Object[] args, Function funObj)
    {
        Shell shell = (Shell)getTopLevelScope(thisObj);
        for (int i = 0; i < args.length; i++) {
            shell.processSource(cx, Context.toString(args[i]));
        }
    }
642894
function loadFunction (js, resolver) {
        immediate(function () {
            try {
                js.call(null, resolver);
            }
            catch (e) {
                resolver.reject(e);
            }
        });
    }
793780
public void execute() throws BuildException {
        checkParameters();
        resetFileLists();
        loadRegisteredScriptExtensions();

        if (javac != null) jointCompilation = true;

        // scan source directories and dest directory to build up
        // compile lists
        String[] list = src.list();
        for (String filename : list) {
            File file = getProject().resolveFile(filename);
            if (!file.exists()) {
                throw new BuildException("srcdir \"" + file.getPath() + "\" does not exist!", getLocation());
            }
            DirectoryScanner ds = this.getDirectoryScanner(file);
            String[] files = ds.getIncludedFiles();
            scanDir(file, destDir != null ? destDir : file, files);
        }

        compile();
        if (updatedProperty != null
                && taskSuccess
                && compileList.length != 0) {
            getProject().setNewProperty(updatedProperty, "true");
        }
    }
770689
@GwtIncompatible("Unnecessary")
  private List<SourceFile> createSourceInputs(
      List<JsModuleSpec> jsModuleSpecs,
      List<FlagEntry<JsSourceType>> files,
      List<JsonFileSpec> jsonFiles,
      List<String> moduleRoots)
      throws IOException {
    if (isInTestMode()) {
      return inputsSupplierForTesting != null ? inputsSupplierForTesting.get()
          : null;
    }
    if (files.isEmpty() && jsonFiles == null) {
      // Request to read from stdin.
      files = ImmutableList.of(new FlagEntry<JsSourceType>(JsSourceType.JS, "-"));
    }

    for (JSError error : deduplicateIjsFiles(files, moduleRoots, !jsModuleSpecs.isEmpty())) {
      compiler.report(error);
    }

    try {
      if (jsonFiles != null) {
        return createInputs(files, jsonFiles, jsModuleSpecs);
      } else {
        return createInputs(files, true, jsModuleSpecs);
      }
    } catch (FlagUsageException e) {
      throw new FlagUsageException("Bad --js flag. " + e.getMessage());
    }
  }
792555
def run(self):
        ""
        # load files from source directory
        files = self.get_files()

        # loop through each middleware
        for func in self.middleware:

            # call each one, ignoring return value
            func(files, self)

        # store and return the result
        self.files.update(files)
        return files
48570
function script(source, options) {
  var tokens

  /* Make sure the require to the main module
   * is showed as if it was a require from
   * `./node_modules`.
   *
   * For example, when the example file
   * (`test/example.js`) requires the main file (as
   * listed in `test/package.json`, `main: "module.js"`)
   * as `./module`, it is replaced with `test`. */
  source = source.replace(EXPRESSION_REQUIRE, replace)

  /* Transform comments into markdown: */
  tokens = []

  source.split('\n').forEach(each)

  return tokens

  function replace($0, $1, $2, $3) {
    var filepath = resolveFrom.silent(
      path.dirname(options.example),
      unquote($2)
    )
    var quote

    if (options.main === filepath && options.name) {
      /* Honour quote style. */
      quote = $2.charAt(0)

      return $1 + quote + options.name + quote + $3
    }

    return $0
  }

  function each(line) {
    var match = line.match(EXPRESSION_COMMENT)

    tokens.push({
      type: match ? 'markdown' : 'javascript',
      value: match ? match[4] : line
    })
  }
}
861775
function loadHooks() {
  var events = this._events;
  var jsFile = /\.js$/i;
  var hooksPath = this.fullPath('hook');
  var loadedHooks = [];
  if (fs.existsSync(hooksPath)) {
    var files = protos.util.ls(hooksPath, jsFile);
    for (var cb,idx,evt,file,len=files.length,i=0; i < len; i++) {
      file = files[i];
      evt = file.replace(jsFile, '');
      loadedHooks.push(evt);
      cb = protos.require(hooksPath + '/' + file, true);
      if (cb instanceof Function) {
        if (RELOADING) {
          var origCb = this.hooks[evt];
          if (origCb instanceof Function) {
            // Hook was added previously
            if (events[evt] instanceof Array) {
              idx = events[evt].indexOf(origCb);
              if (idx >= 0) {
                // If old function is in events array, replace it
                events[evt][idx] = this.hooks[evt] = cb;
              } else {
                // Otherwise, append to events array (add a new event handler)
                events[evt].push(cb);
                this.hooks[evt] = cb;
              }
            } else if (events[evt] instanceof Function) {
              if (events[evt] === origCb) {
                // If evt has only one callback, replace it
                events[evt] = this.hooks[evt] = cb;
              } else {
                // Otherwise, create an array with the old and new events
                events[evt] = [origCb, cb];
              }
            } // No else clause is needed here, it's either Function or Array
          } else {
            // This is a new event handler
            this.hooks[evt] = cb;
            this.on(evt, cb);
          }
        } else {
          // Add the event handler normally
          this.hooks[evt] = cb;
          this.on(evt, cb);
        }
      }
    }
  }

  // Remove any inexisting hooks
  for (evt in this.hooks) {
    if (loadedHooks.indexOf(evt) === -1) {
      app.removeListener(evt, this.hooks[evt]);
      delete this.hooks[evt];
    }
  }

}
1128320
function loader(content, sourceMap) {
  /* jshint validthis:true */

  // loader result is cacheable
  this.cacheable();

  // path of the file being processed
  var filename = path.relative(this.options.context || process.cwd(), this.resourcePath).replace(/\\/g, '/'),
      options  = loaderUtils.parseQuery(this.query),
      useMap   = loader.sourceMap || options.sourceMap;

  // make sure the AST has the data from the original source map
  var pending = migrate.processSync(content, {
    filename : filename,
    sourceMap: useMap && (sourceMap || true),
    quoteChar: options.singleQuote ? '\'' : '"'
  });

  // emit deprecation warning
  if ((pending.isChanged) && (options.deprecate)) {
    var text = '  ' + PACKAGE_NAME + ': @ngInject doctag is deprecated, use "ngInject" string directive instead';
    this.emitWarning(text);
  }

  // emit errors
  if (pending.errors.length) {
    var text = pending.errors.map(indent).join('\n');
    this.emitError(text);
  }

  // complete
  if (useMap) {
    this.callback(null, pending.content, pending.sourceMap);
  } else {
    return pending.content;
  }
}
1119199
function loadScript(url) {
        s = document.createElement('script');
        s.src =url;
        document.body.appendChild(s);
    }
677939
public static void load() {
        if (!isLoaded()) {
            ScriptInjector.fromString(LocalForageResources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
        }
    }
255790
private void processSource(Context cx, String filename)
    {
        if (filename == null) {
            BufferedReader in = new BufferedReader
                (new InputStreamReader(System.in));
            String sourceName = "<stdin>";
            int lineno = 1;
            boolean hitEOF = false;
            do {
                int startline = lineno;
                System.err.print("js> ");
                System.err.flush();
                try {
                    String source = "";
                    // Collect lines of source to compile.
                    while(true) {
                        String newline;
                        newline = in.readLine();
                        if (newline == null) {
                            hitEOF = true;
                            break;
                        }
                        source = source + newline + "\n";
                        lineno++;
                        // Continue collecting as long as more lines
                        // are needed to complete the current
                        // statement.  stringIsCompilableUnit is also
                        // true if the source statement will result in
                        // any error other than one that might be
                        // resolved by appending more source.
                        if (cx.stringIsCompilableUnit(source))
                            break;
                    }
                    Object result = cx.evaluateString(this, source,
                                                      sourceName, startline,
                                                      null);
                    if (result != Context.getUndefinedValue()) {
                        System.err.println(Context.toString(result));
                    }
                }
                catch (WrappedException we) {
                    // Some form of exception was caught by JavaScript and
                    // propagated up.
                    System.err.println(we.getWrappedException().toString());
                    we.printStackTrace();
                }
                catch (EvaluatorException ee) {
                    // Some form of JavaScript error.
                    System.err.println("js: " + ee.getMessage());
                }
                catch (JavaScriptException jse) {
                    // Some form of JavaScript error.
                    System.err.println("js: " + jse.getMessage());
                }
                catch (IOException ioe) {
                    System.err.println(ioe.toString());
                }
                if (quitting) {
                    // The user executed the quit() function.
                    break;
                }
            } while (!hitEOF);
            System.err.println();
        } else {
            FileReader in = null;
            try {
                in = new FileReader(filename);
            }
            catch (FileNotFoundException ex) {
                Context.reportError("Couldn't open file \"" + filename + "\".");
                return;
            }

            try {
                // Here we evalute the entire contents of the file as
                // a script. Text is printed only if the print() function
                // is called.
                cx.evaluateReader(this, in, filename, 1, null);
            }
            catch (WrappedException we) {
                System.err.println(we.getWrappedException().toString());
                we.printStackTrace();
            }
            catch (EvaluatorException ee) {
                System.err.println("js: " + ee.getMessage());
            }
            catch (JavaScriptException jse) {
                System.err.println("js: " + jse.getMessage());
            }
            catch (IOException ioe) {
                System.err.println(ioe.toString());
            }
            finally {
                try {
                    in.close();
                }
                catch (IOException ioe) {
                    System.err.println(ioe.toString());
                }
            }
        }
    }
820055
function _onFinishedLoadingDOM() {
        var request = new XMLHttpRequest();
        request.open("GET", exports.url);
        request.onload = function onLoad() {
            if ((request.status >= 200 && request.status < 300) ||
                    request.status === 304 || request.status === 0) {
                _mapDocumentToSource(request.response);
                _load.resolve();
            } else {
                var msg = "Received status " + request.status + " from XMLHttpRequest while attempting to load source file at " + exports.url;
                _load.reject(msg, { message: msg });
            }
        };
        request.onerror = function onError() {
            var msg = "Could not load source file at " + exports.url;
            _load.reject(msg, { message: msg });
        };
        request.send(null);
    }
1328594
function(sourceOrProgram, filename) {
        
        if (!(this instanceof MetaScript)) {
            __version = Array.prototype.join.call(arguments, '.');
            return;
        }
        
        // Whether constructing from a meta program or, otherwise, a source
        var isProgram = (sourceOrProgram+="").substring(0, 11) === 'MetaScript(';
        
        /**
         * Original source.
         * @type {?string}
         */
        this.source = isProgram ? null : sourceOrProgram;

        /**
         * Original source file name.
         * @type {string}
         */
        this.filename = filename || "main";

        /**
         * The compiled meta program's source.
         * @type {string}
         */
        this.program = isProgram ? sourceOrProgram : MetaScript.compile(sourceOrProgram);
    }
1168208
function(srcFile, callback) {
    new Generator(this.workingDir, srcFile, this.targetDir, this.jumper, this.logger, this.options.docco).run(callback);
  }
857156
function() {

      var filesArray = _files[_currentSegment].slice();

      $.each(filesArray, function(i, file) {

        log('preloading files');

        log('file to preload:' + file.source);
        switch (file.type) {
          case 'IMAGE':
            loadImage(file);
            break;
          case 'VIDEO':
          case 'AUDIO':
            loadMedia(file);
            break;
          case 'SCRIPT':
            loadScript(file);
            break;
          case 'TEXT':
          case 'CSS':
            loadText(file, /CSS/g.test(file.type));
            break;
          default:
            return false;
        }

      });

    }
1104512
function loadJS(src, callback, attrs, timeout, fail, complete) {
    if ($.isObject(src)) {
        callback = src.callback;
        attrs = src.attrs;
        timeout = src.timeout;
        fail = src.fail;
        complete = src.complete;
        src = src.src;
        return loadJS(src, callback, attrs, timeout, fail, complete);
    }
    var script = document.createElement('script');
    var done = false;
    if ($.isObject(attrs)) {
        for (var i in attrs) {
            script.setAttribute(i, attrs[i]);
        }
    }
    var urls = getPath(src);
    src = script.src = urls[0];
    script.async = true;
    script.type = 'text/javascript';
    script.charset = defaultConfig.charset;
    complete = $.isFunction(complete) ? complete : emptyFn;
    script.onload = script.onreadystatechange = function(e) {
        e = e || cleanObj
        if (!done && (e.type === 'load' || /loaded|complete|undefined/.test(script.readyState))) {
            done = true;
            removeNode(script);
            mapLoaded[src] = 'loaded';
            $.isFunction(callback) && callback();
            complete('load');
        }
    };
    script.onerror = function() {
        done = true;
        mapLoaded[src] = 'error';
        $.isFunction(fail) && fail();
        complete('error');
    };
    timeout = $.isNumber(timeout) ? timeout : defaultConfig.timeout;
    if (timeout) {
        setTimeout(function() {
            if (!done) {
                done = true;
                mapLoaded[src] = 'timeout';
                complete('timeout');
            }
        }, timeout);
    }
    mapLoaded[src] = 'pending';
    head.insertBefore(script, base);
    return _;
}
703301
function load_files(){
      var reading_js = false, reading_css = false;
      self.files.some(function(f) {
        // grunt 0.4.3 had one file object..
        if (f.dest_js) {
          dest['dest_js'] = f.dest_js;
          dest['dest_css'] = f.dest_css;
          dest['dest_html'] = f.dest_html;
          filepath = f.src[0];
          if (!filepath || !grunt.file.exists(filepath)) {
            grunt.log.warn('Source file "' + filepath + '" not found.');
            return false;
          }
          src = grunt.file.read(filepath);
          return true;
        }
        // grunt 0.4.2 had multiple files.. strange
        else if (f.dest === "src" && f.src) {
          filepath = f.src.length ? f.src[0] : f.src;

          if (!grunt.file.exists(filepath)) {
            grunt.log.warn('Source file "' + filepath + '" not found.');
            return false;
          }
          src = grunt.file.read(filepath);
          return false;
        }
        else {
          dest[f.dest] = f.orig.src[0];
          return false;
        }
      });
      if (! src || (! dest.dest_js && ! dest.dest_css && ! dest.dest_html)) {
        grunt.log.warn('Please specify src, and dest_js, dest_css, or dest_html.');
        return false;
      }
      html = src;
      return true;
    }