本文整理了Java中org.mozilla.javascript.tools.shell.Global.installRequire()
方法的一些代码示例,展示了Global.installRequire()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global.installRequire()
方法的具体详情如下:
包路径:org.mozilla.javascript.tools.shell.Global
类名称:Global
方法名:installRequire
暂无
代码示例来源:origin: mulesoft-labs/rhinodo
@Override
public Require installRequire(Context cx, List<String> modulePath, boolean sandboxed) {
return super.installRequire(cx, modulePath, sandboxed);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
public Object run(Context cx)
{
if (useRequire) {
require = global.installRequire(cx, modulePath, sandboxed);
}
if (type == PROCESS_FILES) {
processFiles(cx, args);
} else if (type == EVAL_INLINE_SCRIPT) {
evalInlineScript(cx, scriptText);
} else {
throw Kit.codeBug();
}
return null;
}
代码示例来源:origin: com.github.tntim96/rhino
public Object run(Context cx)
{
if (useRequire) {
require = global.installRequire(cx, modulePath, sandboxed);
}
if (type == PROCESS_FILES) {
processFiles(cx, args);
} else if (type == EVAL_INLINE_SCRIPT) {
evalInlineScript(cx, scriptText);
} else {
throw Kit.codeBug();
}
return null;
}
代码示例来源:origin: org.geoserver.script/gs-script-js
public CommonJSEngineFactory(List<String> modulePaths) {
this.modulePaths = modulePaths;
Context cx = CommonJSEngine.enterContext();
try {
global = new Global();
global.initStandardObjects(cx, true);
global.installRequire(cx, modulePaths, true);
} finally {
Context.exit();
}
}
代码示例来源:origin: viltgroup/minium
@Override
protected Void doCall(Context cx, Scriptable s) {
try {
Global global = new Global(cx);
RequireProperties require = rhinoProperties.getRequire();
if (require != null) {
List<String> modulePathURIs = getModulePathURIs(require);
LOGGER.debug("Module paths: {}", modulePathURIs);
global.installRequire(cx, modulePathURIs, require.isSandboxed());
}
// we need to load compat/timeout.js because rhino does not have setTimeout, setInterval, etc.
try (Reader in = new InputStreamReader(classloader.getResourceAsStream("compat/timeout.js"))) {
cx.evaluateReader(global, in, "compat/timeout.js", 1, null);
}
scope = global;
prototype = new NativeObject();
scope.put("__prototype", scope, prototype);
return null;
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!