public class JavascriptRuntime extends Object implements IJavascriptRuntime
| Modifier and Type | Field and Description |
|---|---|
static IWebEngine |
engine |
protected static IJavascriptRuntime |
runtime |
| Constructor and Description |
|---|
JavascriptRuntime() |
| Modifier and Type | Method and Description |
|---|---|
netscape.javascript.JSObject |
execute(String command)
Execute the specified command returning a value (if any)
|
protected String |
getArgString(Object arg)
Takes the specified object and converts the argument to a String.
|
String |
getArrayConstructor(String javascriptObjectType,
Object[] ary)
Gets an array parameter constructor as a String, which then can be
passed to the execute() method.
|
String |
getArrayFunction(String function,
Object[] ary)
Gets an array function as a String, which then can be passed to the
execute() method.
|
String |
getConstructor(String javascriptObjectType,
Object... args)
Gets a constructor as a string which then can be passed to the execute().
|
String |
getFunction(String function,
Object... args)
Gets a function as a String, which then can be passed to the execute()
method.
|
String |
getFunction(String variable,
String function,
Object... args)
Gets a function as a String, which then can be passed to the execute()
method.
|
static IJavascriptRuntime |
getInstance()
Gets a singleton instance of this class, creating one if it doesn't yet
exist.
|
static void |
setDefaultWebEngine(IWebEngine e)
Set the WebEngine that this runtime should use.
|
protected static IJavascriptRuntime runtime
public static IWebEngine engine
public static IJavascriptRuntime getInstance()
public static void setDefaultWebEngine(IWebEngine e)
e - The underlying WebEngine to use.public netscape.javascript.JSObject execute(String command)
execute in interface IJavascriptRuntimecommand - The JavaScript command to executepublic String getConstructor(String javascriptObjectType, Object... args)
getConstructor in interface IJavascriptRuntimejavascriptObjectType - The type of JavaScript object to createargs - The args of the constructorpublic String getArrayConstructor(String javascriptObjectType, Object[] ary)
getArrayConstructor in interface IJavascriptRuntimejavascriptObjectType - type The type of JavaScript object array to createary - The array elementspublic String getFunction(String variable, String function, Object... args)
getFunction in interface IJavascriptRuntimevariable - The variable to invoke the function on.function - The function to invokeargs - Arguments the function requirespublic String getFunction(String function, Object... args)
getFunction in interface IJavascriptRuntimefunction - The function to invokeargs - Arguments the function requirespublic String getArrayFunction(String function, Object[] ary)
getArrayFunction in interface IJavascriptRuntimefunction - The function to invokeary - The array of arguments to pass to the function.Copyright © 2016. All Rights Reserved.