public final class JavaScriptCore
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
JavaScriptCore.Function_JSObjectMakeArrayBufferWithBytesNoCopy |
static interface |
JavaScriptCore.Function_JSObjectMakeConstructor |
static interface |
JavaScriptCore.Function_JSObjectMakeFunctionWithCallback |
static interface |
JavaScriptCore.Function_JSObjectMakeTypedArrayWithBytesNoCopy |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
JSCheckScriptSyntax(JSContextRef ctx,
JSStringRef script,
JSStringRef sourceURL,
int startingLineNumber,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function] JSCheckScriptSyntax
|
static JSClassRef |
JSClassCreate(JSClassDefinition definition)
[@function]
|
static void |
JSClassRelease(JSClassRef jsClass)
[@function]
|
static JSClassRef |
JSClassRetain(JSClassRef jsClass)
[@function]
|
static JSGlobalContextRef |
JSContextGetGlobalContext(JSContextRef ctx)
[@function]
|
static JSObjectRef |
JSContextGetGlobalObject(JSContextRef ctx)
[@function]
|
static JSContextGroupRef |
JSContextGetGroup(JSContextRef ctx)
[@function]
|
static JSContextGroupRef |
JSContextGroupCreate()
[@function]
|
static void |
JSContextGroupRelease(JSContextGroupRef group)
[@function]
|
static JSContextGroupRef |
JSContextGroupRetain(JSContextGroupRef group)
[@function]
|
static JSValueRef |
JSEvaluateScript(JSContextRef ctx,
JSStringRef script,
JSObjectRef thisObject,
JSStringRef sourceURL,
int startingLineNumber,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function] JSEvaluateScript
|
static void |
JSGarbageCollect(JSContextRef ctx)
[@function] JSGarbageCollect
|
static JSStringRef |
JSGlobalContextCopyName(JSGlobalContextRef ctx)
[@function]
|
static JSGlobalContextRef |
JSGlobalContextCreate(JSClassRef globalObjectClass)
[@function]
|
static JSGlobalContextRef |
JSGlobalContextCreateInGroup(JSContextGroupRef group,
JSClassRef globalObjectClass)
[@function]
|
static void |
JSGlobalContextRelease(JSGlobalContextRef ctx)
[@function]
|
static JSGlobalContextRef |
JSGlobalContextRetain(JSGlobalContextRef ctx)
[@function]
|
static void |
JSGlobalContextSetName(JSGlobalContextRef ctx,
JSStringRef name)
[@function]
|
static JSObjectRef |
JSObjectCallAsConstructor(JSContextRef ctx,
JSObjectRef object,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSValueRef |
JSObjectCallAsFunction(JSContextRef ctx,
JSObjectRef object,
JSObjectRef thisObject,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSPropertyNameArrayRef |
JSObjectCopyPropertyNames(JSContextRef ctx,
JSObjectRef object)
[@function]
|
static boolean |
JSObjectDeleteProperty(JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSObjectDeletePropertyForKey(JSContextRef ctx,
JSObjectRef object,
JSValueRef propertyKey,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static long |
JSObjectGetArrayBufferByteLength(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static org.moe.natj.general.ptr.VoidPtr |
JSObjectGetArrayBufferBytesPtr(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static org.moe.natj.general.ptr.VoidPtr |
JSObjectGetPrivate(JSObjectRef object)
[@function]
|
static JSValueRef |
JSObjectGetProperty(JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSValueRef |
JSObjectGetPropertyAtIndex(JSContextRef ctx,
JSObjectRef object,
int propertyIndex,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSValueRef |
JSObjectGetPropertyForKey(JSContextRef ctx,
JSObjectRef object,
JSValueRef propertyKey,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSValueRef |
JSObjectGetPrototype(JSContextRef ctx,
JSObjectRef object)
[@function]
|
static JSObjectRef |
JSObjectGetTypedArrayBuffer(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static long |
JSObjectGetTypedArrayByteLength(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static long |
JSObjectGetTypedArrayByteOffset(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static org.moe.natj.general.ptr.VoidPtr |
JSObjectGetTypedArrayBytesPtr(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static long |
JSObjectGetTypedArrayLength(JSContextRef ctx,
JSObjectRef object,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSObjectHasProperty(JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName)
[@function]
|
static boolean |
JSObjectHasPropertyForKey(JSContextRef ctx,
JSObjectRef object,
JSValueRef propertyKey,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSObjectIsConstructor(JSContextRef ctx,
JSObjectRef object)
[@function]
|
static boolean |
JSObjectIsFunction(JSContextRef ctx,
JSObjectRef object)
[@function]
|
static JSObjectRef |
JSObjectMake(JSContextRef ctx,
JSClassRef jsClass,
org.moe.natj.general.ptr.VoidPtr data)
[@function]
|
static JSObjectRef |
JSObjectMakeArray(JSContextRef ctx,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeArrayBufferWithBytesNoCopy(JSContextRef ctx,
org.moe.natj.general.ptr.VoidPtr bytes,
long byteLength,
JavaScriptCore.Function_JSObjectMakeArrayBufferWithBytesNoCopy bytesDeallocator,
org.moe.natj.general.ptr.VoidPtr deallocatorContext,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeConstructor(JSContextRef ctx,
JSClassRef jsClass,
JavaScriptCore.Function_JSObjectMakeConstructor callAsConstructor)
[@function]
|
static JSObjectRef |
JSObjectMakeDate(JSContextRef ctx,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeDeferredPromise(JSContextRef ctx,
org.moe.natj.general.ptr.Ptr<JSObjectRef> resolve,
org.moe.natj.general.ptr.Ptr<JSObjectRef> reject,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeError(JSContextRef ctx,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeFunction(JSContextRef ctx,
JSStringRef name,
int parameterCount,
org.moe.natj.general.ptr.ConstPtr<JSStringRef> parameterNames,
JSStringRef body,
JSStringRef sourceURL,
int startingLineNumber,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeFunctionWithCallback(JSContextRef ctx,
JSStringRef name,
JavaScriptCore.Function_JSObjectMakeFunctionWithCallback callAsFunction)
[@function]
|
static JSObjectRef |
JSObjectMakeRegExp(JSContextRef ctx,
long argumentCount,
org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeTypedArray(JSContextRef ctx,
int arrayType,
long length,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeTypedArrayWithArrayBuffer(JSContextRef ctx,
int arrayType,
JSObjectRef buffer,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeTypedArrayWithArrayBufferAndOffset(JSContextRef ctx,
int arrayType,
JSObjectRef buffer,
long byteOffset,
long length,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSObjectMakeTypedArrayWithBytesNoCopy(JSContextRef ctx,
int arrayType,
org.moe.natj.general.ptr.VoidPtr bytes,
long byteLength,
JavaScriptCore.Function_JSObjectMakeTypedArrayWithBytesNoCopy bytesDeallocator,
org.moe.natj.general.ptr.VoidPtr deallocatorContext,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSObjectSetPrivate(JSObjectRef object,
org.moe.natj.general.ptr.VoidPtr data)
[@function]
|
static void |
JSObjectSetProperty(JSContextRef ctx,
JSObjectRef object,
JSStringRef propertyName,
JSValueRef value,
int attributes,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static void |
JSObjectSetPropertyAtIndex(JSContextRef ctx,
JSObjectRef object,
int propertyIndex,
JSValueRef value,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static void |
JSObjectSetPropertyForKey(JSContextRef ctx,
JSObjectRef object,
JSValueRef propertyKey,
JSValueRef value,
int attributes,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static void |
JSObjectSetPrototype(JSContextRef ctx,
JSObjectRef object,
JSValueRef value)
[@function]
|
static java.lang.String |
JSPropertyDescriptorConfigurableKey()
[@const]
|
static java.lang.String |
JSPropertyDescriptorEnumerableKey()
[@const]
|
static java.lang.String |
JSPropertyDescriptorGetKey()
[@const]
|
static java.lang.String |
JSPropertyDescriptorSetKey()
[@const]
|
static java.lang.String |
JSPropertyDescriptorValueKey()
[@const]
|
static java.lang.String |
JSPropertyDescriptorWritableKey()
[@group] Property Descriptor Constants
|
static void |
JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator,
JSStringRef propertyName)
[@function]
|
static long |
JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array)
[@function]
|
static JSStringRef |
JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array,
long index)
[@function]
|
static void |
JSPropertyNameArrayRelease(JSPropertyNameArrayRef array)
[@function]
|
static JSPropertyNameArrayRef |
JSPropertyNameArrayRetain(JSPropertyNameArrayRef array)
[@function]
|
static CFStringRef |
JSStringCopyCFString(CFAllocatorRef alloc,
JSStringRef string)
[@function]
|
static JSStringRef |
JSStringCreateWithCFString(CFStringRef string)
[@function]
|
static JSStringRef |
JSStringCreateWithCharacters(org.moe.natj.general.ptr.ConstCharPtr chars,
long numChars)
[@function]
|
static JSStringRef |
JSStringCreateWithUTF8CString(java.lang.String string)
[@function]
|
static org.moe.natj.general.ptr.ConstCharPtr |
JSStringGetCharactersPtr(JSStringRef string)
[@function]
|
static long |
JSStringGetLength(JSStringRef string)
[@function]
|
static long |
JSStringGetMaximumUTF8CStringSize(JSStringRef string)
[@function]
|
static long |
JSStringGetUTF8CString(JSStringRef string,
org.moe.natj.general.ptr.BytePtr buffer,
long bufferSize)
[@function]
|
static boolean |
JSStringIsEqual(JSStringRef a,
JSStringRef b)
[@function]
|
static boolean |
JSStringIsEqualToUTF8CString(JSStringRef a,
java.lang.String b)
[@function]
|
static void |
JSStringRelease(JSStringRef string)
[@function]
|
static JSStringRef |
JSStringRetain(JSStringRef string)
[@function]
|
static JSStringRef |
JSValueCreateJSONString(JSContextRef ctx,
JSValueRef value,
int indent,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static int |
JSValueGetType(JSContextRef ctx,
JSValueRef value)
[@function]
|
static int |
JSValueGetTypedArrayType(JSContextRef ctx,
JSValueRef value,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSValueIsArray(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsBoolean(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsDate(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsEqual(JSContextRef ctx,
JSValueRef a,
JSValueRef b,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSValueIsInstanceOfConstructor(JSContextRef ctx,
JSValueRef value,
JSObjectRef constructor,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static boolean |
JSValueIsNull(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsNumber(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsObject(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsObjectOfClass(JSContextRef ctx,
JSValueRef value,
JSClassRef jsClass)
[@function]
|
static boolean |
JSValueIsStrictEqual(JSContextRef ctx,
JSValueRef a,
JSValueRef b)
[@function]
|
static boolean |
JSValueIsString(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsSymbol(JSContextRef ctx,
JSValueRef value)
[@function]
|
static boolean |
JSValueIsUndefined(JSContextRef ctx,
JSValueRef value)
[@function]
|
static JSValueRef |
JSValueMakeBoolean(JSContextRef ctx,
boolean boolean_)
[@function]
|
static JSValueRef |
JSValueMakeFromJSONString(JSContextRef ctx,
JSStringRef string)
[@function]
|
static JSValueRef |
JSValueMakeNull(JSContextRef ctx)
[@function]
|
static JSValueRef |
JSValueMakeNumber(JSContextRef ctx,
double number)
[@function]
|
static JSValueRef |
JSValueMakeString(JSContextRef ctx,
JSStringRef string)
[@function]
|
static JSValueRef |
JSValueMakeSymbol(JSContextRef ctx,
JSStringRef description)
[@function]
|
static JSValueRef |
JSValueMakeUndefined(JSContextRef ctx)
[@function]
|
static void |
JSValueProtect(JSContextRef ctx,
JSValueRef value)
Garbage collection
[@function]
|
static boolean |
JSValueToBoolean(JSContextRef ctx,
JSValueRef value)
[@function]
|
static double |
JSValueToNumber(JSContextRef ctx,
JSValueRef value,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSObjectRef |
JSValueToObject(JSContextRef ctx,
JSValueRef value,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static JSStringRef |
JSValueToStringCopy(JSContextRef ctx,
JSValueRef value,
org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
[@function]
|
static void |
JSValueUnprotect(JSContextRef ctx,
JSValueRef value)
[@function]
|
static JSClassDefinition |
kJSClassDefinitionEmpty()
[@const] kJSClassDefinitionEmpty
|
public static JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Evaluates a string of JavaScript.
ctx - The execution context to use.script - A JSString containing the script to evaluate.thisObject - The object to use as "this," or NULL to use the global object as "this."sourceURL - A JSString containing a URL for the script's source file. This is used by debuggers and when reporting exceptions. Pass NULL if you do not care to include source file information.startingLineNumber - An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Checks for syntax errors in a string of JavaScript.
ctx - The execution context to use.script - A JSString containing the script to check for syntax errors.sourceURL - A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.startingLineNumber - An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.exception - A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.public static void JSGarbageCollect(JSContextRef ctx)
Performs a JavaScript garbage collection.
JavaScript values that are on the machine stack, in a register, protected by JSValueProtect, set as the global object of an execution context, or reachable from any such value will not be collected.
During JavaScript execution, you are not required to call this function; the JavaScript engine will garbage collect as needed. JavaScript values created within a context group are automatically destroyed when the last reference to the context group is released.
ctx - The execution context to use.public static int JSValueGetType(JSContextRef ctx, JSValueRef value)
Returns a JavaScript value's type.
ctx - The execution context to use.value - The JSValue whose type you want to obtain.public static boolean JSValueIsUndefined(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the undefined type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsNull(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the null type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsBoolean(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the boolean type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsNumber(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the number type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsString(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the string type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsObject(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the object type.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass)
Tests whether a JavaScript value is an object with a given class in its class chain.
ctx - The execution context to use.value - The JSValue to test.jsClass - The JSClass to test against.public static boolean JSValueIsArray(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value is an array.
ctx - The execution context to use.value - The JSValue to test.public static boolean JSValueIsDate(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value is a date.
ctx - The execution context to use.value - The JSValue to test.public static int JSValueGetTypedArrayType(JSContextRef ctx, JSValueRef value, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns a JavaScript value's Typed Array type.
ctx - The execution context to use.value - The JSValue whose Typed Array type to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Tests whether two JavaScript values are equal, as compared by the JS == operator.
ctx - The execution context to use.a - The first value to test.b - The second value to test.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b)
Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
ctx - The execution context to use.a - The first value to test.b - The second value to test.public static boolean JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
ctx - The execution context to use.value - The JSValue to test.constructor - The constructor to test against.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSValueRef JSValueMakeUndefined(JSContextRef ctx)
Creates a JavaScript value of the undefined type.
ctx - The execution context to use.public static JSValueRef JSValueMakeNull(JSContextRef ctx)
Creates a JavaScript value of the null type.
ctx - The execution context to use.public static JSValueRef JSValueMakeBoolean(JSContextRef ctx, boolean boolean_)
Creates a JavaScript value of the boolean type.
ctx - The execution context to use.boolean - The bool to assign to the newly created JSValue.public static JSValueRef JSValueMakeNumber(JSContextRef ctx, double number)
Creates a JavaScript value of the number type.
ctx - The execution context to use.number - The double to assign to the newly created JSValue.public static JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string)
Creates a JavaScript value of the string type.
ctx - The execution context to use.string - The JSString to assign to the newly created JSValue. The
newly created JSValue retains string, and releases it upon garbage collection.public static JSValueRef JSValueMakeFromJSONString(JSContextRef ctx, JSStringRef string)
Creates a JavaScript value from a JSON formatted string.
ctx - The execution context to use.string - The JSString containing the JSON string to be parsed.public static JSStringRef JSValueCreateJSONString(JSContextRef ctx, JSValueRef value, int indent, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript string containing the JSON serialized representation of a JS value.
ctx - The execution context to use.value - The value to serialize.indent - The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSValueToBoolean(JSContextRef ctx, JSValueRef value)
Converts a JavaScript value to boolean and returns the resulting boolean.
ctx - The execution context to use.value - The JSValue to convert.public static double JSValueToNumber(JSContextRef ctx, JSValueRef value, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Converts a JavaScript value to number and returns the resulting number.
ctx - The execution context to use.value - The JSValue to convert.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Converts a JavaScript value to string and copies the result into a JavaScript string.
ctx - The execution context to use.value - The JSValue to convert.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Converts a JavaScript value to object and returns the resulting object.
ctx - The execution context to use.value - The JSValue to convert.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static void JSValueProtect(JSContextRef ctx, JSValueRef value)
Protects a JavaScript value from garbage collection.
Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.
A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
ctx - The execution context to use.value - The JSValue to protect.public static void JSValueUnprotect(JSContextRef ctx, JSValueRef value)
Unprotects a JavaScript value from garbage collection.
A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
ctx - The execution context to use.value - The JSValue to unprotect.public static JSClassRef JSClassCreate(JSClassDefinition definition)
Creates a JavaScript class suitable for use with JSObjectMake.
definition - A JSClassDefinition that defines the class.public static JSClassRef JSClassRetain(JSClassRef jsClass)
Retains a JavaScript class.
jsClass - The JSClass to retain.public static void JSClassRelease(JSClassRef jsClass)
Releases a JavaScript class.
jsClass - The JSClass to release.public static JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, org.moe.natj.general.ptr.VoidPtr data)
Creates a JavaScript object.
The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data.
data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate.
ctx - The execution context to use.jsClass - The JSClass to assign to the object. Pass NULL to use the default object class.data - A void* to set as the object's private data. Pass NULL to specify no private data.public static JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JavaScriptCore.Function_JSObjectMakeFunctionWithCallback callAsFunction)
Convenience method for creating a JavaScript function with a given callback as its implementation.
ctx - The execution context to use.name - A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.callAsFunction - The JSObjectCallAsFunctionCallback to invoke when the function is called.public static JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JavaScriptCore.Function_JSObjectMakeConstructor callAsConstructor)
Convenience method for creating a JavaScript constructor.
The default object constructor takes no arguments and constructs an object of class jsClass with no private data. If the constructor is inherited via JS subclassing and the value returned from callAsConstructor was created with jsClass, then the returned object will have it's prototype overridden to the derived class's prototype.
ctx - The execution context to use.jsClass - A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class.callAsConstructor - A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor.public static JSObjectRef JSObjectMakeArray(JSContextRef ctx, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Array object.
The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument is supplied, this function returns an array with one element.
ctx - The execution context to use.argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeDate(JSContextRef ctx, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
ctx - The execution context to use.argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeError(JSContextRef ctx, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
ctx - The execution context to use.argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
ctx - The execution context to use.argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, int parameterCount, org.moe.natj.general.ptr.ConstPtr<JSStringRef> parameterNames, JSStringRef body, JSStringRef sourceURL, int startingLineNumber, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a function with a given script as its body.
Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution.
ctx - The execution context to use.name - A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function.parameterCount - An integer count of the number of parameter names in parameterNames.parameterNames - A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0.body - A JSString containing the script to use as the function's body.sourceURL - A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.startingLineNumber - An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1.exception - A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.public static JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
Gets an object's prototype.
ctx - The execution context to use.object - A JSObject whose prototype you want to get.public static void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
Sets an object's prototype.
ctx - The execution context to use.object - The JSObject whose prototype you want to set.value - A JSValue to set as the object's prototype.public static boolean JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
Tests whether an object has a given property.
object - The JSObject to test.propertyName - A JSString containing the property's name.public static JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Gets a property from an object.
ctx - The execution context to use.object - The JSObject whose property you want to get.propertyName - A JSString containing the property's name.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, int attributes, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Sets a property on an object.
ctx - The execution context to use.object - The JSObject whose property you want to set.propertyName - A JSString containing the property's name.value - A JSValueRef to use as the property's value.attributes - A logically ORed set of JSPropertyAttributes to give to the property.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Deletes a property from an object.
ctx - The execution context to use.object - The JSObject whose property you want to delete.propertyName - A JSString containing the property's name.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, int propertyIndex, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Gets a property from an object by numeric index.
Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties.
ctx - The execution context to use.object - The JSObject whose property you want to get.propertyIndex - An integer value that is the property's name.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, int propertyIndex, JSValueRef value, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Sets a property on an object by numeric index.
Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties.
ctx - The execution context to use.object - The JSObject whose property you want to set.propertyIndex - The property's name as a number.value - A JSValue to use as the property's value.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static org.moe.natj.general.ptr.VoidPtr JSObjectGetPrivate(JSObjectRef object)
Gets an object's private data.
object - A JSObject whose private data you want to get.public static boolean JSObjectSetPrivate(JSObjectRef object, org.moe.natj.general.ptr.VoidPtr data)
Sets a pointer to private data on an object.
The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data.
object - The JSObject whose private data you want to set.data - A void* to set as the object's private data.public static boolean JSObjectIsFunction(JSContextRef ctx, JSObjectRef object)
Tests whether an object can be called as a function.
ctx - The execution context to use.object - The JSObject to test.public static JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Calls an object as a function.
ctx - The execution context to use.object - The JSObject to call as a function.thisObject - The object to use as "this," or NULL to use the global object as "this."argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object)
Tests whether an object can be called as a constructor.
ctx - The execution context to use.object - The JSObject to test.public static JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, long argumentCount, org.moe.natj.general.ptr.ConstPtr<JSValueRef> arguments, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Calls an object as a constructor.
ctx - The execution context to use.object - The JSObject to call as a constructor.argumentCount - An integer count of the number of arguments in arguments.arguments - A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object)
Gets the names of an object's enumerable properties.
ctx - The execution context to use.object - The object whose property names you want to get.public static JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array)
Retains a JavaScript property name array.
array - The JSPropertyNameArray to retain.public static void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array)
Releases a JavaScript property name array.
array - The JSPropetyNameArray to release.public static long JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array)
Gets a count of the number of items in a JavaScript property name array.
array - The array from which to retrieve the count.public static JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, long index)
Gets a property name at a given index in a JavaScript property name array.
array - The array from which to retrieve the property name.index - The index of the property name to retrieve.public static void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName)
Adds a property name to a JavaScript property name accumulator.
accumulator - The accumulator object to which to add the property name.propertyName - The property name to add.public static JSContextGroupRef JSContextGroupCreate()
Creates a JavaScript context group.
A JSContextGroup associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging JavaScript objects between contexts in different groups will produce undefined behavior. When objects from the same context group are used in multiple threads, explicit synchronization is required.
A JSContextGroup may need to run deferred tasks on a run loop, such as garbage collection or resolving WebAssembly compilations. By default, calling JSContextGroupCreate will use the run loop of the thread it was called on. Currently, there is no API to change a JSContextGroup's run loop once it has been created.
public static JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group)
Retains a JavaScript context group.
group - The JSContextGroup to retain.public static void JSContextGroupRelease(JSContextGroupRef group)
Releases a JavaScript context group.
group - The JSContextGroup to release.public static JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
Creates a global JavaScript execution context.
JSGlobalContextCreate allocates a global object and populates it with all the built-in JavaScript objects, such as Object, Function, String, and Array.
In WebKit version 4.0 and later, the context is created in a unique context group. Therefore, scripts may execute in it concurrently with scripts executing in other contexts. However, you may not use values created in the context in other contexts.
globalObjectClass - The class to use when creating the global object. Pass
NULL to use the default object class.public static JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass)
Creates a global JavaScript execution context in the context group provided.
JSGlobalContextCreateInGroup allocates a global object and populates it with all the built-in JavaScript objects, such as Object, Function, String, and Array.
globalObjectClass - The class to use when creating the global object. Pass
NULL to use the default object class.group - The context group to use. The created global context retains the group.
Pass NULL to create a unique group for the context.public static JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx)
Retains a global JavaScript execution context.
ctx - The JSGlobalContext to retain.public static void JSGlobalContextRelease(JSGlobalContextRef ctx)
Releases a global JavaScript execution context.
ctx - The JSGlobalContext to release.public static JSObjectRef JSContextGetGlobalObject(JSContextRef ctx)
Gets the global object of a JavaScript execution context.
ctx - The JSContext whose global object you want to get.public static JSContextGroupRef JSContextGetGroup(JSContextRef ctx)
Gets the context group to which a JavaScript execution context belongs.
ctx - The JSContext whose group you want to get.public static JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx)
Gets the global context of a JavaScript execution context.
ctx - The JSContext whose global context you want to get.public static JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
Gets a copy of the name of a context.
A JSGlobalContext's name is exposed for remote debugging to make it easier to identify the context you would like to attach to.
ctx - The JSGlobalContext whose name you want to get.public static void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name)
Sets the remote debugging name for a context.
ctx - The JSGlobalContext that you want to name.name - The remote debugging name to set on ctx.public static JSStringRef JSStringCreateWithCharacters(org.moe.natj.general.ptr.ConstCharPtr chars, long numChars)
Creates a JavaScript string from a buffer of Unicode characters.
chars - The buffer of Unicode characters to copy into the new JSString.numChars - The number of characters to copy from the buffer pointed to by chars.public static JSStringRef JSStringCreateWithUTF8CString(java.lang.String string)
Creates a JavaScript string from a null-terminated UTF8 string.
string - The null-terminated UTF8 string to copy into the new JSString.public static JSStringRef JSStringRetain(JSStringRef string)
Retains a JavaScript string.
string - The JSString to retain.public static void JSStringRelease(JSStringRef string)
Releases a JavaScript string.
string - The JSString to release.public static long JSStringGetLength(JSStringRef string)
Returns the number of Unicode characters in a JavaScript string.
string - The JSString whose length (in Unicode characters) you want to know.public static org.moe.natj.general.ptr.ConstCharPtr JSStringGetCharactersPtr(JSStringRef string)
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
string - The JSString whose backing store you want to access.public static long JSStringGetMaximumUTF8CStringSize(JSStringRef string)
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
string - The JSString whose maximum converted size (in bytes) you
want to know.public static long JSStringGetUTF8CString(JSStringRef string, org.moe.natj.general.ptr.BytePtr buffer, long bufferSize)
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
string - The source JSString.buffer - The destination byte buffer into which to copy a null-terminated
UTF8 representation of string. On return, buffer contains a UTF8 string
representation of string. If bufferSize is too small, buffer will contain only
partial results. If buffer is not at least bufferSize bytes in size,
behavior is undefined.bufferSize - The size of the external buffer in bytes.public static boolean JSStringIsEqual(JSStringRef a, JSStringRef b)
Tests whether two JavaScript strings match.
a - The first JSString to test.b - The second JSString to test.public static boolean JSStringIsEqualToUTF8CString(JSStringRef a, java.lang.String b)
Tests whether a JavaScript string matches a null-terminated UTF8 string.
a - The JSString to test.b - The null-terminated UTF8 string to test.public static JSObjectRef JSObjectMakeTypedArray(JSContextRef ctx, int arrayType, long length, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Typed Array object with the given number of elements.
ctx - The execution context to use.arrayType - A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.length - The number of elements to be in the new Typed Array.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeTypedArrayWithBytesNoCopy(JSContextRef ctx, int arrayType, org.moe.natj.general.ptr.VoidPtr bytes, long byteLength, JavaScriptCore.Function_JSObjectMakeTypedArrayWithBytesNoCopy bytesDeallocator, org.moe.natj.general.ptr.VoidPtr deallocatorContext, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Typed Array object from an existing pointer.
If an exception is thrown during this function the bytesDeallocator will always be called.
ctx - The execution context to use.arrayType - A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.bytes - A pointer to the byte buffer to be used as the backing store of the Typed Array object.byteLength - The number of bytes pointed to by the parameter bytes.bytesDeallocator - The allocator to use to deallocate the external buffer when the JSTypedArrayData object is deallocated.deallocatorContext - A pointer to pass back to the deallocator.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeTypedArrayWithArrayBuffer(JSContextRef ctx, int arrayType, JSObjectRef buffer, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
ctx - The execution context to use.arrayType - A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.buffer - An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeTypedArrayWithArrayBufferAndOffset(JSContextRef ctx, int arrayType, JSObjectRef buffer, long byteOffset, long length, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.
ctx - The execution context to use.arrayType - A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.buffer - An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object.byteOffset - The byte offset for the created Typed Array. byteOffset should aligned with the element size of arrayType.length - The number of elements to include in the Typed Array.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static org.moe.natj.general.ptr.VoidPtr JSObjectGetTypedArrayBytesPtr(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls.
ctx - The execution context to use.object - The Typed Array object whose backing store pointer to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static long JSObjectGetTypedArrayLength(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns the length of a JavaScript Typed Array object.
ctx - The execution context to use.object - The Typed Array object whose length to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static long JSObjectGetTypedArrayByteLength(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns the byte length of a JavaScript Typed Array object.
ctx - The execution context to use.object - The Typed Array object whose byte length to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static long JSObjectGetTypedArrayByteOffset(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns the byte offset of a JavaScript Typed Array object.
ctx - The execution context to use.object - The Typed Array object whose byte offset to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectGetTypedArrayBuffer(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
ctx - The execution context to use.object - The JSObjectRef whose Typed Array type data pointer to obtain.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSObjectRef JSObjectMakeArrayBufferWithBytesNoCopy(JSContextRef ctx, org.moe.natj.general.ptr.VoidPtr bytes, long byteLength, JavaScriptCore.Function_JSObjectMakeArrayBufferWithBytesNoCopy bytesDeallocator, org.moe.natj.general.ptr.VoidPtr deallocatorContext, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript Array Buffer object from an existing pointer.
If an exception is thrown during this function the bytesDeallocator will always be called.
ctx - The execution context to use.bytes - A pointer to the byte buffer to be used as the backing store of the Typed Array object.byteLength - The number of bytes pointed to by the parameter bytes.bytesDeallocator - The allocator to use to deallocate the external buffer when the Typed Array data object is deallocated.deallocatorContext - A pointer to pass back to the deallocator.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static org.moe.natj.general.ptr.VoidPtr JSObjectGetArrayBufferBytesPtr(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
The pointer returned by this function is temporary and is not guaranteed to remain valid across JavaScriptCore API calls.
object - The Array Buffer object whose internal backing store pointer to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static long JSObjectGetArrayBufferByteLength(JSContextRef ctx, JSObjectRef object, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Returns the number of bytes in a JavaScript data object.
ctx - The execution context to use.object - The JS Arary Buffer object whose length in bytes to return.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSStringRef JSStringCreateWithCFString(CFStringRef string)
Creates a JavaScript string from a CFString.
This function is optimized to take advantage of cases when CFStringGetCharactersPtr returns a valid pointer.
string - The CFString to copy into the new JSString.public static CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
Creates a CFString from a JavaScript string.
alloc - The alloc parameter to pass to CFStringCreate.string - The JSString to copy into the new CFString.public static JSClassDefinition kJSClassDefinitionEmpty()
A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.
Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method:
JSClassDefinition definition = kJSClassDefinitionEmpty; definition.finalize = Finalize;
public static java.lang.String JSPropertyDescriptorWritableKey()
These keys may assist in creating a property descriptor for use with the defineProperty method on JSValue. Property descriptors must fit one of three descriptions:
Data Descriptor:
- A descriptor containing one or both of the keys value and writable,
and optionally containing one or both of the keys enumerable and
configurable. A data descriptor may not contain either the get or
set key.
A data descriptor may be used to create or modify the attributes of a
data property on an object (replacing any existing accessor property).
Accessor Descriptor:
- A descriptor containing one or both of the keys get and set, and
optionally containing one or both of the keys enumerable and
configurable. An accessor descriptor may not contain either the value
or writable key.
An accessor descriptor may be used to create or modify the attributes of
an accessor property on an object (replacing any existing data property).
Generic Descriptor:
- A descriptor containing one or both of the keys enumerable and
configurable. A generic descriptor may not contain any of the keys
value, writable, get, or set.
A generic descriptor may be used to modify the attributes of an existing
data or accessor property, or to create a new data property.
[@const]
public static java.lang.String JSPropertyDescriptorEnumerableKey()
public static java.lang.String JSPropertyDescriptorConfigurableKey()
public static java.lang.String JSPropertyDescriptorValueKey()
public static java.lang.String JSPropertyDescriptorGetKey()
public static java.lang.String JSPropertyDescriptorSetKey()
public static boolean JSValueIsSymbol(JSContextRef ctx, JSValueRef value)
Tests whether a JavaScript value's type is the symbol type.
ctx - The execution context to use.value - The JSValue to test.public static JSValueRef JSValueMakeSymbol(JSContextRef ctx, JSStringRef description)
Creates a JavaScript value of the symbol type.
ctx - The execution context to use.description - A description of the newly created symbol value.public static JSObjectRef JSObjectMakeDeferredPromise(JSContextRef ctx, org.moe.natj.general.ptr.Ptr<JSObjectRef> resolve, org.moe.natj.general.ptr.Ptr<JSObjectRef> reject, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Creates a JavaScript promise object by invoking the provided executor.
ctx - The execution context to use.resolve - A pointer to a JSObjectRef in which to store the resolve function for the new promise. Pass NULL if you do not care to store the resolve callback.reject - A pointer to a JSObjectRef in which to store the reject function for the new promise. Pass NULL if you do not care to store the reject callback.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSObjectHasPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Tests whether an object has a given property using a JSValueRef as the property key.
This function is the same as performing "propertyKey in object" from JavaScript.
object - The JSObject to test.propertyKey - A JSValueRef containing the property key to use when looking up the property.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static JSValueRef JSObjectGetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Gets a property from an object using a JSValueRef as the property key.
This function is the same as performing "object[propertyKey]" from JavaScript.
ctx - The execution context to use.object - The JSObject whose property you want to get.propertyKey - A JSValueRef containing the property key to use when looking up the property.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static void JSObjectSetPropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, int attributes, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Sets a property on an object using a JSValueRef as the property key.
This function is the same as performing "object[propertyKey] = value" from JavaScript.
ctx - The execution context to use.object - The JSObject whose property you want to set.propertyKey - A JSValueRef containing the property key to use when looking up the property.value - A JSValueRef to use as the property's value.attributes - A logically ORed set of JSPropertyAttributes to give to the property.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.public static boolean JSObjectDeletePropertyForKey(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, org.moe.natj.general.ptr.Ptr<JSValueRef> exception)
Deletes a property from an object using a JSValueRef as the property key.
This function is the same as performing "delete object[propertyKey]" from JavaScript.
ctx - The execution context to use.object - The JSObject whose property you want to delete.propertyKey - A JSValueRef containing the property key to use when looking up the property.exception - A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.