本文整理了Java中org.mozilla.javascript.Context.callFunctionWithContinuations()
方法的一些代码示例,展示了Context.callFunctionWithContinuations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.callFunctionWithContinuations()
方法的具体详情如下:
包路径:org.mozilla.javascript.Context
类名称:Context
方法名:callFunctionWithContinuations
[英]Call function that may pause execution by capturing a continuation. Caller must be prepared to catch a ContinuationPending exception and resume execution by calling #resumeContinuation(Object,Scriptable,Object).
[中]
代码示例来源:origin: rhino/js
/**
* Execute script that may pause execution by capturing a continuation.
* Caller must be prepared to catch a ContinuationPending exception
* and resume execution by calling
* {@link #resumeContinuation(Object, Scriptable, Object)}.
* @param script The script to execute. Script must have been compiled
* with interpreted mode (optimization level -1)
* @param scope The scope to execute the script against
* @throws ContinuationPending if the script calls a function that results
* in a call to {@link #captureContinuation()}
* @since 1.7 Release 2
*/
public Object executeScriptWithContinuations(Script script,
Scriptable scope)
throws ContinuationPending
{
if (!(script instanceof InterpretedFunction) ||
!((InterpretedFunction)script).isScript())
{
// Can only be applied to scripts
throw new IllegalArgumentException("Script argument was not" +
" a script or was not created by interpreted mode ");
}
return callFunctionWithContinuations((InterpretedFunction) script,
scope, ScriptRuntime.emptyArgs);
}
代码示例来源:origin: io.apigee/rhino
/**
* Execute script that may pause execution by capturing a continuation.
* Caller must be prepared to catch a ContinuationPending exception
* and resume execution by calling
* {@link #resumeContinuation(Object, Scriptable, Object)}.
* @param script The script to execute. Script must have been compiled
* with interpreted mode (optimization level -1)
* @param scope The scope to execute the script against
* @throws ContinuationPending if the script calls a function that results
* in a call to {@link #captureContinuation()}
* @since 1.7 Release 2
*/
public Object executeScriptWithContinuations(Script script,
Scriptable scope)
throws ContinuationPending
{
if (!(script instanceof InterpretedFunction) ||
!((InterpretedFunction)script).isScript())
{
// Can only be applied to scripts
throw new IllegalArgumentException("Script argument was not" +
" a script or was not created by interpreted mode ");
}
return callFunctionWithContinuations((InterpretedFunction) script,
scope, ScriptRuntime.emptyArgs);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Execute script that may pause execution by capturing a continuation.
* Caller must be prepared to catch a ContinuationPending exception
* and resume execution by calling
* {@link #resumeContinuation(Object, Scriptable, Object)}.
* @param script The script to execute. Script must have been compiled
* with interpreted mode (optimization level -1)
* @param scope The scope to execute the script against
* @throws ContinuationPending if the script calls a function that results
* in a call to {@link #captureContinuation()}
* @since 1.7 Release 2
*/
public Object executeScriptWithContinuations(Script script,
Scriptable scope)
throws ContinuationPending
{
if (!(script instanceof InterpretedFunction) ||
!((InterpretedFunction)script).isScript())
{
// Can only be applied to scripts
throw new IllegalArgumentException("Script argument was not" +
" a script or was not created by interpreted mode ");
}
return callFunctionWithContinuations((InterpretedFunction) script,
scope, ScriptRuntime.emptyArgs);
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Execute script that may pause execution by capturing a continuation.
* Caller must be prepared to catch a ContinuationPending exception
* and resume execution by calling
* {@link #resumeContinuation(Object, Scriptable, Object)}.
* @param script The script to execute. Script must have been compiled
* with interpreted mode (optimization level -1)
* @param scope The scope to execute the script against
* @throws ContinuationPending if the script calls a function that results
* in a call to {@link #captureContinuation()}
* @since 1.7 Release 2
*/
public Object executeScriptWithContinuations(Script script,
Scriptable scope)
throws ContinuationPending
{
if (!(script instanceof InterpretedFunction) ||
!((InterpretedFunction)script).isScript())
{
// Can only be applied to scripts
throw new IllegalArgumentException("Script argument was not" +
" a script or was not created by interpreted mode ");
}
return callFunctionWithContinuations((InterpretedFunction) script,
scope, ScriptRuntime.emptyArgs);
}
代码示例来源:origin: geogebra/geogebra
/**
* Execute script that may pause execution by capturing a continuation.
* Caller must be prepared to catch a ContinuationPending exception
* and resume execution by calling
* {@link #resumeContinuation(Object, Scriptable, Object)}.
* @param script The script to execute. Script must have been compiled
* with interpreted mode (optimization level -1)
* @param scope The scope to execute the script against
* @throws ContinuationPending if the script calls a function that results
* in a call to {@link #captureContinuation()}
* @since 1.7 Release 2
*/
public Object executeScriptWithContinuations(Script script,
Scriptable scope)
throws ContinuationPending
{
if (!(script instanceof InterpretedFunction) ||
!((InterpretedFunction)script).isScript())
{
// Can only be applied to scripts
throw new IllegalArgumentException("Script argument was not" +
" a script or was not created by interpreted mode ");
}
return callFunctionWithContinuations((InterpretedFunction) script,
scope, ScriptRuntime.emptyArgs);
}
内容来源于网络,如有侵权,请联系作者删除!