public class JSContext extends JSObject
Modifier and Type | Class and Description |
---|---|
static interface |
JSContext.IJSExceptionHandler
Object interface for handling JSExceptions.
|
JSObject.jsexport, JSObject.Property<T>
JSPropertyAttributeDontDelete, JSPropertyAttributeDontEnum, JSPropertyAttributeNone, JSPropertyAttributeReadOnly
Constructor and Description |
---|
JSContext()
Creates a new JavaScript context
|
JSContext(java.lang.Class<?> iface)
Creates a JavaScript context, and defines the global object with interface 'iface'.
|
JSContext(JSContextGroup inGroup)
Creates a new JavaScript context in the context group 'inGroup'.
|
JSContext(JSContextGroup inGroup,
java.lang.Class<?> iface)
Creates a JavaScript context in context group 'inGroup', and defines the global object
with interface 'iface'.
|
Modifier and Type | Method and Description |
---|---|
void |
clearExceptionHandler()
Clears a previously set exception handler.
|
org.liquidplayer.javascript.JNIJSContext |
ctxRef()
Gets the JavaScriptCore context reference
|
JSValue |
evaluateScript(java.lang.String script)
Executes a the JavaScript code in 'script' in this context
|
JSValue |
evaluateScript(java.lang.String script,
java.lang.String sourceURL,
int startingLineNumber)
Executes a the JavaScript code in 'script' in this context
|
JSContextGroup |
getGroup()
Gets the context group to which this context belongs.
|
long |
getJSCContext() |
void |
setExceptionHandler(JSContext.IJSExceptionHandler handler)
Sets the JS exception handler for this context.
|
void |
sync(java.lang.Runnable runnable) |
void |
throwJSException(JSException exception)
If an exception handler is set, calls the exception handler, otherwise throws
the JSException.
|
__nullFunc, deleteProperty, getThis, hashCode, hasProperty, isConstructor, isFunction, property, property, property, propertyAtIndex, propertyAtIndex, propertyNames, prototype, prototype
equals, getContext, isArray, isBoolean, isDate, isEqual, isFloat32Array, isFloat64Array, isInstanceOfConstructor, isInt16Array, isInt32Array, isInt8Array, isNull, isNumber, isObject, isStrictEqual, isString, isTypedArray, isUint16Array, isUint32Array, isUint8Array, isUint8ClampedArray, isUndefined, toBoolean, toFunction, toJSArray, toJSON, toNumber, toObject, toString, valueHash, valueRef
public JSContext()
public JSContext(JSContextGroup inGroup)
inGroup
- The context group to create the context inpublic JSContext(java.lang.Class<?> iface)
iface
- The interface to expose to JavaScriptpublic JSContext(JSContextGroup inGroup, java.lang.Class<?> iface)
inGroup
- The context group to create the context iniface
- The interface to expose to JavaScriptpublic void sync(java.lang.Runnable runnable)
public long getJSCContext()
public void setExceptionHandler(JSContext.IJSExceptionHandler handler)
handler
- An object that implements 'IJSExceptionHandler'public void clearExceptionHandler()
public void throwJSException(JSException exception)
exception
- The JSException to be thrownpublic JSContextGroup getGroup()
public org.liquidplayer.javascript.JNIJSContext ctxRef()
public JSValue evaluateScript(@NonNull java.lang.String script, java.lang.String sourceURL, int startingLineNumber)
script
- The code to executesourceURL
- The URI of the source file, only used for reporting in stack trace (optional)startingLineNumber
- The beginning line number, only used for reporting in stack trace (optional)public JSValue evaluateScript(java.lang.String script)
script
- The code to execute