javascriptcore/jscore_bindings library

Classes

JscFfi
JSClassAttributes
enum JSClassAttributes A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.
JSClassDefinition
struct JSStaticFunction This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.
JSPropertyAttributes
enum JSPropertyAttributes A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
JSStaticFunction
struct JSStaticFunction This structure describes a statically declared function property.
JSStaticFunctionStruct
JSStaticValue
struct JSStaticValue This structure describes a statically declared value property.
JSStaticValueStruct
JSType
enum JSType A constant identifying the type of a JSValue.
JSTypedArrayType
enum JSTypedArrayType A constant identifying the Typed Array type of a JSObjectRef.

Properties

jSCheckScriptSyntax Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> script, Pointer<NativeType> sourceURL, int startingLineNumber, Pointer<Pointer<NativeType>> exception)
Checks for syntax errors in a string of JavaScript. ctx (JSContextRef) The execution context to use. script (JSStringRef) A JSString containing the script to check for syntax errors. sourceURL (JSStringRef) 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 (int) 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 (JSValueRef*) 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. @result (bool) true if the script is syntactically correct, otherwise false.
final
jSClassCreate Pointer<NativeType> Function(Pointer<JSClassDefinition> definition)
Creates a JavaScript class suitable for use with JSObjectMake. definition (JSClassDefinition*) A JSClassDefinition that defines the class. @result (JSClassRef) A JSClass with the given definition. Ownership follows the Create Rule.
final
jSClassRelease → void Function(Pointer<NativeType> jsClass)
Releases a JavaScript class. jsClass (JSClassRef) The JSClass to release.
final
jSClassRetain Pointer<NativeType> Function(Pointer<NativeType> jsClass)
Retains a JavaScript class. jsClass (JSClassRef) The JSClass to retain. @result (JSClassRef) A JSClass that is the same as jsClass.
final
jSContextGetGlobalContext Pointer<NativeType> Function(Pointer<NativeType> ctx)
Gets the global context of a JavaScript execution context. ctx (JSContextRef) The JSContext whose global context you want to get. @result (JSGlobalContextRef) ctx's global context.
final
jSContextGetGlobalObject Pointer<NativeType> Function(Pointer<NativeType> ctx)
Gets the global object of a JavaScript execution context. ctx (JSContextRef) The JSContext whose global object you want to get. @result (JSObjectRef) ctx's global object.
final
jSContextGetGroup Pointer<NativeType> Function(Pointer<NativeType> ctx)
Gets the context group to which a JavaScript execution context belongs. ctx (JSContextRef) The JSContext whose group you want to get. @result (JSContextGroupRef) ctx's group.
final
jSContextGroupCreate Pointer<NativeType> Function()
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.
final
jSContextGroupRelease → void Function(Pointer<NativeType> group)
Releases a JavaScript context group. group (JSContextGroupRef) The JSContextGroup to release.
final
jSContextGroupRetain Pointer<NativeType> Function(Pointer<NativeType> group)
Retains a JavaScript context group. group (JSContextGroupRef) The JSContextGroup to retain. @result (JSContextGroupRef) A JSContextGroup that is the same as group.
final
jSEvaluateScript Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> script, Pointer<NativeType> thisObject, Pointer<NativeType> sourceURL, int startingLineNumber, Pointer<Pointer<NativeType>> exception)
Evaluates a string of JavaScript. ctx (JSContextRef) The execution context to use. script (JSStringRef) A JSString containing the script to evaluate. thisObject (JSObjectRef) The object to use as "this," or NULL to use the global object as "this." sourceURL (JSStringRef) 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 (int) 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 (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSValueRef) The JSValue that results from evaluating script, or NULL if an exception is thrown.
final
jSGarbageCollect → void Function(Pointer<NativeType> 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.
final
jSGlobalContextCopyName Pointer<NativeType> Function(Pointer<NativeType> 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 (JSGlobalContextRef) The JSGlobalContext whose name you want to get. @result (JSStringRef) The name for ctx.
final
jSGlobalContextCreate Pointer<NativeType> Function(Pointer<NativeType> 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.
final
jSGlobalContextCreateInGroup Pointer<NativeType> Function(Pointer<NativeType> group, Pointer<NativeType> 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. group (JSContextGroupRef) The context group to use. The created global context retains the group. Pass NULL to create a unique group for the context. globalObjectClass (JSClassRef) The class to use when creating the global object. Pass NULL to use the default object class. @result (JSGlobalContextRef) A JSGlobalContext with a global object of class globalObjectClass and a context group equal to group.
final
jSGlobalContextRelease → void Function(Pointer<NativeType> ctx)
Releases a global JavaScript execution context. ctx (JSGlobalContextRef) The JSGlobalContext to release.
final
jSGlobalContextRetain Pointer<NativeType> Function(Pointer<NativeType> ctx)
Retains a global JavaScript execution context. ctx (JSGlobalContextRef) The JSGlobalContext to retain. @result (JSGlobalContextRef) A JSGlobalContext that is the same as ctx.
final
jSGlobalContextSetName → void Function(Pointer<NativeType> ctx, Pointer<NativeType> name)
Sets the remote debugging name for a context. ctx (JSGlobalContextRef) The JSGlobalContext that you want to name. name (JSStringRef) The remote debugging name to set on ctx.
final
jSObjectCallAsConstructor Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, int argumentCount, Pointer<NativeType> arguments, Pointer<Pointer<NativeType>> exception)
Calls an object as a constructor. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject to call as a constructor. argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor.
final
jSObjectCallAsFunction Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> thisObject, int argumentCount, Pointer<NativeType> arguments, Pointer<Pointer<NativeType>> exception)
Calls an object as a function. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject to call as a function. thisObject (JSObjectRef) The object to use as "this," or NULL to use the global object as "this." argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSValueRef) The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function.
final
jSObjectCopyPropertyNames Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
Gets the names of an object's enumerable properties. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The object whose property names you want to get. @result (JSPropertyNameArrayRef) A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule.
final
jSObjectDeleteProperty int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
Deletes a property from an object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to delete. propertyName (JSStringRef) A JSString containing the property's name. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set).
final
jSObjectDeletePropertyForKey int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyKey, Pointer<Pointer<NativeType>> exception)
Deletes a property from an object using a JSValueRef as the property key. This function is the same as performing "delete objectpropertyKey" from JavaScript. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to delete. propertyKey (JSValueRef) A JSValueRef containing the property key to use when looking up the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set).
final
jSObjectGetArrayBufferByteLength int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> exception)
Returns the number of bytes in a JavaScript data object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JS Arary Buffer object whose length in bytes to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (size_t) The number of bytes stored in the data object.
final
jSObjectGetArrayBufferBytesPtr Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> 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. ctx (JSContextRef) object (JSObjectRef) The Array Buffer object whose internal backing store pointer to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (void*) A pointer to the raw data buffer that serves as object's backing store or NULL if object is not an Array Buffer object.
final
jSObjectGetPrivate Pointer<NativeType> Function(Pointer<NativeType> object)
Gets an object's private data. object (JSObjectRef) A JSObject whose private data you want to get. @result (void*) A void* that is the object's private data, if the object has private data, otherwise NULL.
final
jSObjectGetProperty Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
Gets a property from an object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to get. propertyName (JSStringRef) A JSString containing the property's name. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSValueRef) The property's value if object has the property, otherwise the undefined value.
final
jSObjectGetPropertyAtIndex Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, int propertyIndex, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to get. propertyIndex (unsigned) An integer value that is the property's name. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSValueRef) The property's value if object has the property, otherwise the undefined value.
final
jSObjectGetPropertyForKey Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyKey, Pointer<Pointer<NativeType>> exception)
Gets a property from an object using a JSValueRef as the property key. This function is the same as performing "objectpropertyKey" from JavaScript. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to get. propertyKey (JSValueRef) A JSValueRef containing the property key to use when looking up the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSValueRef) The property's value if object has the property key, otherwise the undefined value.
final
jSObjectGetPrototype Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
Gets an object's prototype. ctx (JSContextRef) The execution context to use. object (JSObjectRef) A JSObject whose prototype you want to get. @result (JSValueRef) A JSValue that is the object's prototype.
final
jSObjectGetTypedArrayBuffer Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> exception)
Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObjectRef whose Typed Array type data pointer to obtain. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef with a JSTypedArrayType of kJSTypedArrayTypeArrayBuffer or NULL if object is not a Typed Array.
final
jSObjectGetTypedArrayByteLength int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> exception)
Returns the byte length of a JavaScript Typed Array object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The Typed Array object whose byte length to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (size_t) The byte length of the Typed Array object or 0 if the object is not a Typed Array object.
final
jSObjectGetTypedArrayByteOffset int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> exception)
Returns the byte offset of a JavaScript Typed Array object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The Typed Array object whose byte offset to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (size_t) The byte offset of the Typed Array object or 0 if the object is not a Typed Array object.
final
jSObjectGetTypedArrayBytesPtr Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. object (JSObjectRef) The Typed Array object whose backing store pointer to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (void*) A pointer to the raw data buffer that serves as object's backing store or NULL if object is not a Typed Array object.
final
jSObjectGetTypedArrayLength int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<Pointer<NativeType>> exception)
Returns the length of a JavaScript Typed Array object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The Typed Array object whose length to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (size_t) The length of the Typed Array object or 0 if the object is not a Typed Array object.
final
jSObjectHasProperty int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName)
Tests whether an object has a given property. ctx (JSContextRef) object (JSObjectRef) The JSObject to test. propertyName (JSStringRef) A JSString containing the property's name. @result (bool) true if the object has a property whose name matches propertyName, otherwise false.
final
jSObjectHasPropertyForKey int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyKey, Pointer<Pointer<NativeType>> 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. ctx (JSContextRef) object (JSObjectRef) The JSObject to test. propertyKey (JSValueRef) A JSValueRef containing the property key to use when looking up the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if the object has a property whose name matches propertyKey, otherwise false.
final
jSObjectIsConstructor int Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
Tests whether an object can be called as a constructor. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject to test. @result (bool) true if the object can be called as a constructor, otherwise false.
final
jSObjectIsFunction int Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
Tests whether an object can be called as a function. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject to test. @result (bool) true if the object can be called as a function, otherwise false.
final
jSObjectMake Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> jsClass, Pointer<NativeType> 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.
final
jSObjectMakeArray Pointer<NativeType> Function(Pointer<NativeType> ctx, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObject that is an Array.
final
jSObjectMakeArrayBufferWithBytesNoCopy Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> bytes, int byteLength, Pointer<NativeFunction<JSTypedArrayBytesDeallocator>> bytesDeallocator, Pointer<NativeType> deallocatorContext, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. bytes (void*) A pointer to the byte buffer to be used as the backing store of the Typed Array object. byteLength (size_t) The number of bytes pointed to by the parameter bytes. bytesDeallocator (JSTypedArrayBytesDeallocator) The allocator to use to deallocate the external buffer when the Typed Array data object is deallocated. deallocatorContext (void*) A pointer to pass back to the deallocator. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef Array Buffer whose backing store is the same as the one pointed to by bytes or NULL if there was an error.
final
jSObjectMakeConstructor Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> jsClass, Pointer<NativeFunction<JSObjectCallAsConstructorCallback>> 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. ctx (JSContextRef) The execution context to use. jsClass (JSClassRef) 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 (JSObjectCallAsConstructorCallback) A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor. @result (JSObjectRef) A JSObject that is a constructor. The object's prototype will be the default object prototype.
final
jSObjectMakeDate Pointer<NativeType> Function(Pointer<NativeType> ctx, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript Date object, as if by invoking the built-in Date constructor. ctx (JSContextRef) The execution context to use. argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObject that is a Date.
final
jSObjectMakeDeferredPromise Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> resolve, Pointer<NativeType> reject, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript promise object by invoking the provided executor. ctx (JSContextRef) The execution context to use. resolve (JSObjectRef*) 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 (JSObjectRef*) 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 (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObject that is a promise or NULL if an exception occurred.
final
jSObjectMakeError Pointer<NativeType> Function(Pointer<NativeType> ctx, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript Error object, as if by invoking the built-in Error constructor. ctx (JSContextRef) The execution context to use. argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObject that is a Error.
final
jSObjectMakeFunction Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> name, int parameterCount, Pointer<NativeType> parameterNames, Pointer<NativeType> body, Pointer<NativeType> sourceURL, int startingLineNumber, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. name (JSStringRef) 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 (unsigned) An integer count of the number of parameter names in parameterNames. parameterNames (JSStringRef[]) A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. body (JSStringRef) A JSString containing the script to use as the function's body. sourceURL (JSStringRef) 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 (int) 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 (JSValueRef*) 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. @result (JSObjectRef) A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype.
final
jSObjectMakeFunctionWithCallback Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> name, Pointer<NativeFunction<JSObjectCallAsFunctionCallback>> callAsFunction)
Convenience method for creating a JavaScript function with a given callback as its implementation. ctx (JSContextRef) The execution context to use. name (JSStringRef) 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 (JSObjectCallAsFunctionCallback) The JSObjectCallAsFunctionCallback to invoke when the function is called. @result (JSObjectRef) A JSObject that is a function. The object's prototype will be the default function prototype.
final
jSObjectMakeRegExp Pointer<NativeType> Function(Pointer<NativeType> ctx, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor. ctx (JSContextRef) The execution context to use. argumentCount (size_t) An integer count of the number of arguments in arguments. arguments (JSValueRef[]) A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObject that is a RegExp.
final
jSObjectMakeTypedArray Pointer<NativeType> Function(Pointer<NativeType> ctx, int arrayType, int length, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript Typed Array object with the given number of elements. ctx (JSContextRef) The execution context to use. arrayType (JSTypedArrayType) A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. length (size_t) The number of elements to be in the new Typed Array. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef that is a Typed Array with all elements set to zero or NULL if there was an error.
final
jSObjectMakeTypedArrayWithArrayBuffer Pointer<NativeType> Function(Pointer<NativeType> ctx, int arrayType, Pointer<NativeType> buffer, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object. ctx (JSContextRef) The execution context to use. arrayType (JSTypedArrayType) A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. buffer (JSObjectRef) An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer.
final
jSObjectMakeTypedArrayWithArrayBufferAndOffset Pointer<NativeType> Function(Pointer<NativeType> ctx, int arrayType, Pointer<NativeType> buffer, int byteOffset, int length, Pointer<Pointer<NativeType>> exception)
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length. ctx (JSContextRef) The execution context to use. arrayType (JSTypedArrayType) A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. buffer (JSObjectRef) An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. byteOffset (size_t) The byte offset for the created Typed Array. byteOffset should aligned with the element size of arrayType. length (size_t) The number of elements to include in the Typed Array. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef that is a Typed Array or NULL if there was an error. The backing store of the Typed Array will be buffer.
final
jSObjectMakeTypedArrayWithBytesNoCopy Pointer<NativeType> Function(Pointer<NativeType> ctx, int arrayType, Pointer<NativeType> bytes, int byteLength, Pointer<NativeFunction<JSTypedArrayBytesDeallocator>> bytesDeallocator, Pointer<NativeType> deallocatorContext, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. arrayType (JSTypedArrayType) A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. bytes (void*) A pointer to the byte buffer to be used as the backing store of the Typed Array object. byteLength (size_t) The number of bytes pointed to by the parameter bytes. bytesDeallocator (JSTypedArrayBytesDeallocator) The allocator to use to deallocate the external buffer when the JSTypedArrayData object is deallocated. deallocatorContext (void*) A pointer to pass back to the deallocator. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) A JSObjectRef Typed Array whose backing store is the same as the one pointed to by bytes or NULL if there was an error.
final
jSObjectSetPrivate int Function(Pointer<NativeType> object, Pointer<NativeType> 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 (JSObjectRef) The JSObject whose private data you want to set. data (void*) A void* to set as the object's private data. @result (bool) true if object can store private data, otherwise false.
final
jSObjectSetProperty → void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<NativeType> value, int attributes, Pointer<Pointer<NativeType>> exception)
Sets a property on an object. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to set. propertyName (JSStringRef) A JSString containing the property's name. value (JSValueRef) A JSValueRef to use as the property's value. attributes (JSPropertyAttributes) A logically ORed set of JSPropertyAttributes to give to the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
final
jSObjectSetPropertyAtIndex → void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, int propertyIndex, Pointer<NativeType> value, Pointer<Pointer<NativeType>> 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 (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to set. propertyIndex (unsigned) The property's name as a number. value (JSValueRef) A JSValue to use as the property's value. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
final
jSObjectSetPropertyForKey → void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyKey, Pointer<NativeType> value, int attributes, Pointer<Pointer<NativeType>> exception)
Sets a property on an object using a JSValueRef as the property key. This function is the same as performing "objectpropertyKey = value" from JavaScript. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose property you want to set. propertyKey (JSValueRef) A JSValueRef containing the property key to use when looking up the property. value (JSValueRef) A JSValueRef to use as the property's value. attributes (JSPropertyAttributes) A logically ORed set of JSPropertyAttributes to give to the property. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.
final
jSObjectSetPrototype → void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> value)
Sets an object's prototype. ctx (JSContextRef) The execution context to use. object (JSObjectRef) The JSObject whose prototype you want to set. value (JSValueRef) A JSValue to set as the object's prototype.
final
jSPropertyNameAccumulatorAddName → void Function(Pointer<NativeType> accumulator, Pointer<NativeType> propertyName)
Adds a property name to a JavaScript property name accumulator. accumulator (JSPropertyNameAccumulatorRef) The accumulator object to which to add the property name. propertyName (JSStringRef) The property name to add.
final
jSPropertyNameArrayGetCount int Function(Pointer<NativeType> array)
Gets a count of the number of items in a JavaScript property name array. array (JSPropertyNameArrayRef) The array from which to retrieve the count. @result (size_t) An integer count of the number of names in array.
final
jSPropertyNameArrayGetNameAtIndex Pointer<NativeType> Function(Pointer<NativeType> array, int index)
Gets a property name at a given index in a JavaScript property name array. array (JSPropertyNameArrayRef) The array from which to retrieve the property name. index (size_t) The index of the property name to retrieve. @result (JSStringRef) A JSStringRef containing the property name.
final
jSPropertyNameArrayRelease → void Function(Pointer<NativeType> array)
Releases a JavaScript property name array. array (JSPropertyNameArrayRef) The JSPropetyNameArray to release.
final
jSPropertyNameArrayRetain Pointer<NativeType> Function(Pointer<NativeType> array)
Retains a JavaScript property name array. array (JSPropertyNameArrayRef) The JSPropertyNameArray to retain. @result (JSPropertyNameArrayRef) A JSPropertyNameArray that is the same as array.
final
jSStringCreateWithCharacters Pointer<NativeType> Function(Pointer<Pointer<NativeType>> chars, Pointer<NativeType> numChars)
Creates a JavaScript string from a buffer of Unicode characters. chars (JSChar*) The buffer of Unicode characters to copy into the new JSString. numChars (size_t) The number of characters to copy from the buffer pointed to by chars. @result (JSStringRef) A JSString containing chars. Ownership follows the Create Rule.
final
jSStringCreateWithUTF8CString Pointer<NativeType> Function(Pointer<Utf8> string)
Creates a JavaScript string from a null-terminated UTF8 string. string (char*) The null-terminated UTF8 string to copy into the new JSString. @result (JSStringRef) A JSString containing string. Ownership follows the Create Rule.
final
jSStringGetCharactersPtr Pointer<Utf16> Function(Pointer<NativeType> string)
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string. string (JSStringRef) The JSString whose backing store you want to access. @result (const JSChar*) A pointer to the Unicode character buffer that serves as string's backing store, which will be deallocated when string is deallocated.
final
jSStringGetLength int Function(Pointer<NativeType> string)
Returns the number of Unicode characters in a JavaScript string. string (JSStringRef) The JSString whose length (in Unicode characters) you want to know. @result (size_t) The number of Unicode characters stored in string.
final
jSStringGetMaximumUTF8CStringSize int Function(Pointer<NativeType> string)
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string. string (JSStringRef) The JSString whose maximum converted size (in bytes) you want to know. @result (size_t) The maximum number of bytes that could be required to convert string into a null-terminated UTF8 string. The number of bytes that the conversion actually ends up requiring could be less than this, but never more.
final
jSStringGetUTF8CString int Function(Pointer<NativeType> string, Pointer<NativeType> buffer, int bufferSize)
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer. string (JSStringRef) The source JSString. buffer (char*) 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 (size_t) The size of the external buffer in bytes. @result (size_t) The number of bytes written into buffer (including the null-terminator byte).
final
jSStringIsEqual int Function(Pointer<NativeType> a, Pointer<NativeType> b)
Tests whether two JavaScript strings match. a (JSStringRef) The first JSString to test. b (JSStringRef) The second JSString to test. @result (bool) true if the two strings match, otherwise false.
final
jSStringIsEqualToUTF8CString Pointer<NativeType> Function(Pointer<NativeType> a, Pointer<NativeType> b)
Tests whether a JavaScript string matches a null-terminated UTF8 string. a (JSStringRef) The JSString to test. b (char*) The null-terminated UTF8 string to test. @result (bool) true if the two strings match, otherwise false.
final
jSStringRelease → void Function(Pointer<NativeType> string)
Releases a JavaScript string. string (JSStringRef) The JSString to release.
final
jSStringRetain Pointer<NativeType> Function(Pointer<NativeType> string)
Retains a JavaScript string. string (JSStringRef) The JSString to retain. @result (JSStringRef) A JSString that is the same as string.
final
jSValueCreateJSONString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, int indent, Pointer<NativeType> exception)
Creates a JavaScript string containing the JSON serialized representation of a JS value. ctx (JSContextRef) The execution context to use. value (JSValueRef) The value to serialize. indent (unsigned) 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 (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSStringRef) A JSString with the result of serialization, or NULL if an exception is thrown.
final
jSValueGetType int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Returns a JavaScript value's type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue whose type you want to obtain. @result (JSType) A value of type JSType that identifies value's type.
final
jSValueGetTypedArrayType int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Returns a JavaScript value's Typed Array type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue whose Typed Array type to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSTypedArrayType) A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object.
final
jSValueIsArray int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value is an array. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value is an array, otherwise false.
final
jSValueIsBoolean int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the boolean type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the boolean type, otherwise false.
final
jSValueIsDate int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value is a date. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value is a date, otherwise false.
final
jSValueIsEqual int Function(Pointer<NativeType> ctx, Pointer<NativeType> a, Pointer<NativeType> b, Pointer<NativeType> exception)
Tests whether two JavaScript values are equal, as compared by the JS == operator. ctx (JSContextRef) The execution context to use. a (JSValueRef) The first value to test. b (JSValueRef) The second value to test. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if the two values are equal, false if they are not equal or an exception is thrown.
final
jSValueIsInstanceOfConstructor int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> constructor, Pointer<NativeType> exception)
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. constructor (JSObjectRef) The constructor to test against. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
final
jSValueIsNull int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the null type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the null type, otherwise false.
final
jSValueIsNumber int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the number type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the number type, otherwise false.
final
jSValueIsObject int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the object type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the object type, otherwise false.
final
jSValueIsObjectOfClass int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> jsClass)
Tests whether a JavaScript value is an object with a given class in its class chain. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. jsClass (JSClassRef) The JSClass to test against. @result (bool) true if value is an object and has jsClass in its class chain, otherwise false.
final
jSValueIsStrictEqual int Function(Pointer<NativeType> ctx, Pointer<NativeType> a, Pointer<NativeType> b)
Tests whether two JavaScript values are strict equal, as compared by the JS === operator. ctx (JSContextRef) The execution context to use. a (JSValueRef) The first value to test. b (JSValueRef) The second value to test. @result (bool) true if the two values are strict equal, otherwise false.
final
jSValueIsString int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the string type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the string type, otherwise false.
final
jSValueIsSymbol int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the symbol type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the symbol type, otherwise false.
final
jSValueIsUndefined int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the undefined type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the undefined type, otherwise false.
final
jSValueMakeBoolean Pointer<NativeType> Function(Pointer<NativeType> ctx, int boolean)
Creates a JavaScript value of the boolean type. ctx (JSContextRef) The execution context to use. boolean (bool) The bool to assign to the newly created JSValue. @result (JSValueRef) A JSValue of the boolean type, representing the value of boolean.
final
jSValueMakeFromJSONString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> string)
Creates a JavaScript value from a JSON formatted string. ctx (JSContextRef) The execution context to use. string (JSStringRef) The JSString containing the JSON string to be parsed. @result (JSValueRef) A JSValue containing the parsed value, or NULL if the input is invalid.
final
jSValueMakeNull Pointer<NativeType> Function(Pointer<NativeType> ctx)
Creates a JavaScript value of the null type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique null value.
final
jSValueMakeNumber Pointer<NativeType> Function(Pointer<NativeType> ctx, double number)
Creates a JavaScript value of the number type. ctx (JSContextRef) The execution context to use. number (double) The double to assign to the newly created JSValue. @result (JSValueRef) A JSValue of the number type, representing the value of number.
final
jSValueMakeString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> string)
Creates a JavaScript value of the string type. ctx (JSContextRef) The execution context to use. string (JSStringRef) The JSString to assign to the newly created JSValue. The newly created JSValue retains string, and releases it upon garbage collection. @result (JSValueRef) A JSValue of the string type, representing the value of string.
final
jSValueMakeSymbol Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> description)
Creates a JavaScript value of the symbol type. ctx (JSContextRef) The execution context to use. description (JSStringRef) A description of the newly created symbol value. @result (JSValueRef) A unique JSValue of the symbol type, whose description matches the one provided.
final
jSValueMakeUndefined Pointer<NativeType> Function(Pointer<NativeType> ctx)
Creates a JavaScript value of the undefined type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique undefined value.
final
jSValueProtect → void Function(Pointer<NativeType> ctx, Pointer<NativeType> 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.
final
jSValueToBoolean int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Converts a JavaScript value to boolean and returns the resulting boolean. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. @result (bool) The boolean result of conversion.
final
jSValueToNumber double Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to number and returns the resulting number. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (double) The numeric result of conversion, or NaN if an exception is thrown.
final
jSValueToObject Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to object and returns the resulting object. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) The JSObject result of conversion, or NULL if an exception is thrown.
final
jSValueToStringCopy Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to string and copies the result into a JavaScript string. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSStringRef) A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
final
jSValueUnprotect → void Function(Pointer<NativeType> ctx, Pointer<NativeType> 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 (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to unprotect.
final

Typedefs

JSObjectCallAsConstructorCallback = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> constructor, Uint32 argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
typedef JSObjectCallAsConstructorCallback The callback invoked when an object is used as a constructor in a 'new' expression. ctx The execution context to use. constructor A JSObject that is the constructor being called. argumentCount An integer count of the number of arguments in arguments. arguments A JSValue array of the arguments passed to the function. exception A pointer to a JSValueRef in which to return an exception, if any. @result A JSObject that is the constructor's return value. If you named your function CallAsConstructor, you would declare it like this:
JSObjectCallAsConstructorCallbackDart = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> constructor, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
JSObjectCallAsFunctionCallback = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> function, Pointer<NativeType> thisObject, Uint32 argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
typedef JSObjectCallAsFunctionCallback The callback invoked when an object is called as a function. ctx The execution context to use. function A JSObject that is the function being called. thisObject A JSObject that is the 'this' variable in the function's scope. argumentCount An integer count of the number of arguments in arguments. arguments A JSValue array of the arguments passed to the function. exception A pointer to a JSValueRef in which to return an exception, if any. @result A JSValue that is the function's return value. If you named your function CallAsFunction, you would declare it like this:
JSObjectCallAsFunctionCallbackDart = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> function, Pointer<NativeType> thisObject, int argumentCount, Pointer<Pointer<NativeType>> arguments, Pointer<Pointer<NativeType>> exception)
JSObjectConvertToTypeCallback = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Int8 type, Pointer<Pointer<NativeType>> exception)
typedef JSObjectConvertToTypeCallback The callback invoked when converting an object to a particular JavaScript type. ctx The execution context to use. object The JSObject to convert. type A JSType specifying the JavaScript type to convert to. exception A pointer to a JSValueRef in which to return an exception, if any. @result The objects's converted value, or NULL if the object was not converted. If you named your function ConvertToType, you would declare it like this:
JSObjectConvertToTypeCallbackDart = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, int type, Pointer<Pointer<NativeType>> exception)
JSObjectDeletePropertyCallback = Int8 Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
typedef JSObjectDeletePropertyCallback The callback invoked when deleting a property. ctx The execution context to use. object The JSObject in which to delete the property. propertyName A JSString containing the name of the property to delete. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if propertyName was successfully deleted, otherwise false. If you named your function DeleteProperty, you would declare it like this:
JSObjectDeletePropertyCallbackDart = int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
JSObjectFinalizeCallback = Void Function(Pointer<NativeType> object)
typedef JSObjectFinalizeCallback The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. object The JSObject being finalized. If you named your function Finalize, you would declare it like this:
JSObjectFinalizeCallbackDart = void Function(Pointer<NativeType> object)
JSObjectGetPropertyCallback = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
typedef JSObjectGetPropertyCallback The callback invoked when getting a property's value. ctx The execution context to use. object The JSObject to search for the property. propertyName A JSString containing the name of the property to get. exception A pointer to a JSValueRef in which to return an exception, if any. @result The property's value if object has the property, otherwise NULL. If you named your function GetProperty, you would declare it like this:
JSObjectGetPropertyCallbackDart = Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<Pointer<NativeType>> exception)
JSObjectGetPropertyNamesCallback = Void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyNames)
typedef JSObjectGetPropertyNamesCallback The callback invoked when collecting the names of an object's properties. ctx The execution context to use. object The JSObject whose property names are being collected. propertyNames A JavaScript property name accumulator in which to accumulate the names of object's properties. If you named your function GetPropertyNames, you would declare it like this:
JSObjectGetPropertyNamesCallbackDart = void Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyNames)
JSObjectHasInstanceCallback = Int8 Function(Pointer<NativeType> ctx, Pointer<NativeType> constructor, Pointer<NativeType> possibleInstance, Pointer<Pointer<NativeType>> exception)
typedef JSObjectHasInstanceCallback hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. ctx The execution context to use. constructor The JSObject that is the target of the 'instanceof' expression. possibleInstance The JSValue being tested to determine if it is an instance of constructor. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if possibleInstance is an instance of constructor, otherwise false. If you named your function HasInstance, you would declare it like this:
JSObjectHasInstanceCallbackDart = int Function(Pointer<NativeType> ctx, Pointer<NativeType> constructor, Pointer<NativeType> possibleInstance, Pointer<Pointer<NativeType>> exception)
JSObjectHasPropertyCallback = Int8 Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName)
typedef JSObjectHasPropertyCallback The callback invoked when determining whether an object has a property. ctx The execution context to use. object The JSObject to search for the property. propertyName A JSString containing the name of the property look up. @result true if object has the property, otherwise false. If you named your function HasProperty, you would declare it like this:
JSObjectHasPropertyCallbackDart = int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName)
JSObjectInitializeCallback = Void Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
typedef JSObjectInitializeCallback The callback invoked when an object is first created. ctx The execution context to use. object The JSObject being created. If you named your function Initialize, you would declare it like this:
JSObjectInitializeCallbackDart = void Function(Pointer<NativeType> ctx, Pointer<NativeType> object)
JSObjectSetPropertyCallback = Int8 Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<NativeType> value, Pointer<Pointer<NativeType>> exception)
typedef JSObjectSetPropertyCallback The callback invoked when setting a property's value. ctx The execution context to use. object The JSObject on which to set the property's value. propertyName A JSString containing the name of the property to set. value A JSValue to use as the property's value. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if the property was set, otherwise false. If you named your function SetProperty, you would declare it like this:
JSObjectSetPropertyCallbackDart = int Function(Pointer<NativeType> ctx, Pointer<NativeType> object, Pointer<NativeType> propertyName, Pointer<NativeType> value, Pointer<Pointer<NativeType>> exception)
JSTypedArrayBytesDeallocator = Void Function(Pointer<NativeType> bytes, Pointer<NativeType> deallocatorContext)
typedef JSTypedArrayBytesDeallocator A function used to deallocate bytes passed to a Typed Array constructor. The function should take two arguments. The first is a pointer to the bytes that were originally passed to the Typed Array constructor. The second is a pointer to additional information desired at the time the bytes are to be freed. typedef void (JSTypedArrayBytesDeallocator)(void bytes, void* deallocatorContext);
JSTypedArrayBytesDeallocatorDart = void Function(Pointer<NativeType> bytes, Pointer<NativeType> deallocatorContext)