use of org.mozilla.javascript.Function in project jslint4java by happygiraffe.
the class JSLintBuilder method fromReader.
/**
* Initialize the scope with an arbitrary jslint.
*
* @param reader
* an input source providing jslint.js.
* @param name
* the name of the resource backed by the reader
* @return a configured {@link JSLint}
* @throws IOException
* if there are any problems reading from {@code reader} .
*/
@NeedsContext
public JSLint fromReader(Reader reader, String name) throws IOException {
try {
Context cx = contextFactory.enterContext();
ScriptableObject scope = cx.initStandardObjects();
cx.evaluateReader(scope, reader, name, 1, null);
Function lintFunc = (Function) scope.get("JSLINT", scope);
return new JSLint(contextFactory, lintFunc);
} finally {
Context.exit();
}
}
Aggregations