public class JSContext extends JSObject
| Modifier and Type | Class and Description |
|---|---|
static interface |
JSContext.IJSExceptionHandler
Object interface for handling JSExceptions.
|
| Modifier and Type | Field and Description |
|---|---|
java.lang.Object |
mMutex |
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.
|
java.lang.Long |
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,
JSObject thiz)
Executes a the JavaScript code in 'script' in this context
|
JSValue |
evaluateScript(java.lang.String script,
JSObject thiz,
java.lang.String sourceURL,
int startingLineNumber)
Executes a the JavaScript code in 'script' in this context
|
void |
garbageCollect()
Forces JavaScript garbage collection on this context
|
JSContextGroup |
getGroup()
Gets the context group to which this context belongs.
|
void |
setExceptionHandler(JSContext.IJSExceptionHandler handler)
Sets the JS exception handler for this context.
|
void |
throwJSException(JSException exception)
If an exception handler is set, calls the exception handler, otherwise throws
the JSException.
|
__nullFunc, callAsFunction, callAsFunction, callAsFunction, callAsFunction, deleteProperty, getThis, hashCode, hasProperty, isConstructor, isFunction, property, property, property, propertyAtIndex, propertyAtIndex, propertyNames, prototype, prototypeequals, getContext, isArray, isBoolean, isDate, isEqual, isInstanceOfConstructor, isNull, isNumber, isObject, isStrictEqual, isString, isUndefined, toBoolean, toFunction, toJSArray, toJSON, toJSON, toNumber, toObject, toString, valueRefpublic JSContext()
public JSContext(JSContextGroup inGroup)
inGroup - The context group to create the context inpublic JSContext(java.lang.Class<?> iface)
throws JSException
iface - The interface to expose to JavaScriptJSExceptionpublic JSContext(JSContextGroup inGroup, java.lang.Class<?> iface) throws JSException
inGroup - The context group to create the context iniface - The interface to expose to JavaScriptJSExceptionpublic void setExceptionHandler(JSContext.IJSExceptionHandler handler)
handler - An object that implements 'IJSExceptionHandler'public void clearExceptionHandler()
public void throwJSException(JSException exception) throws JSException
exception - The JSException to be thrownJSExceptionpublic JSContextGroup getGroup()
public java.lang.Long ctxRef()
public JSValue evaluateScript(java.lang.String script, JSObject thiz, java.lang.String sourceURL, int startingLineNumber) throws JSException
script - The code to executethiz - The 'this' objectsourceURL - 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)JSExceptionpublic JSValue evaluateScript(java.lang.String script, JSObject thiz) throws JSException
script - The code to executethiz - The 'this' objectJSExceptionpublic JSValue evaluateScript(java.lang.String script) throws JSException
script - The code to executeJSExceptionpublic void garbageCollect()