jsc_binding library

Classes

JSC
JSClass_
JSClass__
JSClassAttributesRef
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.
JSContext_
JSContext__
JSContextGroup_
JSContextGroup__
JSPropertyAttributesRef
JSPropertyNameAccumulator_
JSPropertyNameAccumulator__
JSPropertyNameArray_
JSPropertyNameArray__
JSStaticFunction_
struct JSStaticFunction This structure describes a statically declared function property.
JSStaticValue_
struct JSStaticValue This structure describes a statically declared value property.
JSString_
JSString__
JSTypedArrayTypeRef
JSTypeRef
JSValue_
JSValue__

Properties

JSCheckScriptSyntax bool Function(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, Pointer<JSValueRef> 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 JSClassRef 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(JSClassRef jsClass)
Releases a JavaScript class. jsClass (JSClassRef) The JSClass to release.
final
JSClassReleaseAddress Pointer<NativeFunction<Void Function(JSClassRef)>>
final
JSClassRetain JSClassRef Function(JSClassRef jsClass)
Retains a JavaScript class. jsClass (JSClassRef) The JSClass to retain. @result (JSClassRef) A JSClass that is the same as jsClass.
final
JSContextGetGlobalContext JSGlobalContextRef Function(JSContextRef 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 JSObjectRef Function(JSContextRef 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 JSContextGroupRef Function(JSContextRef 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 JSContextGroupRef 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(JSContextGroupRef group)
Releases a JavaScript context group. group (JSContextGroupRef) The JSContextGroup to release.
final
JSContextGroupReleaseAddress Pointer<NativeFunction<Void Function(JSContextGroupRef)>>
final
JSContextGroupRetain JSContextGroupRef Function(JSContextGroupRef group)
Retains a JavaScript context group. group (JSContextGroupRef) The JSContextGroup to retain. @result (JSContextGroupRef) A JSContextGroup that is the same as group.
final
JSEvaluateScript JSValueRef Function(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, Pointer<JSValueRef> 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(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.
final
JSGlobalContextCopyName JSStringRef Function(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 (JSGlobalContextRef) The JSGlobalContext whose name you want to get. @result (JSStringRef) The name for ctx.
final
JSGlobalContextCreate JSGlobalContextRef Function(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.
final
JSGlobalContextCreateInGroup JSGlobalContextRef Function(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. 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(JSGlobalContextRef ctx)
Releases a global JavaScript execution context. ctx (JSGlobalContextRef) The JSGlobalContext to release.
final
JSGlobalContextReleaseAddress Pointer<NativeFunction<Void Function(JSGlobalContextRef)>>
final
JSGlobalContextRetain JSGlobalContextRef Function(JSGlobalContextRef ctx)
Retains a global JavaScript execution context. ctx (JSGlobalContextRef) The JSGlobalContext to retain. @result (JSGlobalContextRef) A JSGlobalContext that is the same as ctx.
final
JSGlobalContextSetInspectable → void Function(JSGlobalContextRef ctx, bool inspectable)
Sets the remote debugging name for a context. ctx The JSGlobalContextRef that you want to name. inspectable The remote debugging name to set on ctx.
final
JSGlobalContextSetName → void Function(JSGlobalContextRef ctx, JSStringRef 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 JSObjectRef Function(JSContextRef ctx, JSObjectRef object, int argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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 JSValueRef Function(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, int argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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 JSPropertyNameArrayRef Function(JSContextRef ctx, JSObjectRef 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 bool Function(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, Pointer<JSValueRef> 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(JSContextRef ctx, JSObjectRef object, Pointer<JSValueRef> 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<Void> Function(JSContextRef ctx, JSObjectRef object, Pointer<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. 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<Void> Function(JSObjectRef 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 JSValueRef Function(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, Pointer<JSValueRef> 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 JSValueRef Function(JSContextRef ctx, JSObjectRef object, int propertyIndex, Pointer<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 (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 JSValueRef Function(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, Pointer<JSValueRef> 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 JSValueRef Function(JSContextRef ctx, JSObjectRef 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 JSObjectRef Function(JSContextRef ctx, JSObjectRef object, Pointer<JSValueRef> 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(JSContextRef ctx, JSObjectRef object, Pointer<JSValueRef> 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(JSContextRef ctx, JSObjectRef object, Pointer<JSValueRef> 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<Void> Function(JSContextRef ctx, JSObjectRef object, Pointer<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 (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(JSContextRef ctx, JSObjectRef object, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSObjectRef object, JSStringRef 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 bool Function(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, Pointer<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. 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 bool Function(JSContextRef ctx, JSObjectRef 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 bool Function(JSContextRef ctx, JSObjectRef 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 JSObjectRef Function(JSContextRef ctx, JSClassRef jsClass, Pointer<Void> 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 JSObjectRef Function(JSContextRef ctx, int argumentCount, Pointer<JSValueRef> arguments, Pointer<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 (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 JSObjectRef Function(JSContextRef ctx, Pointer<Void> bytes, int byteLength, Pointer<NativeFunction<JSTypedArrayBytesDeallocator_>> bytesDeallocator, Pointer<Void> deallocatorContext, Pointer<JSValueRef> exception)
MacOS 10.12, iOS 10.0 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 JSObjectRef Function(JSContextRef ctx, JSClassRef 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 JSObjectRef Function(JSContextRef ctx, int argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, Pointer<JSObjectRef> resolve, Pointer<JSObjectRef> reject, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, int argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, JSStringRef name, int parameterCount, Pointer<JSStringRef> parameterNames, JSStringRef body, JSStringRef sourceURL, int startingLineNumber, Pointer<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 (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 JSObjectRef Function(JSContextRef ctx, JSStringRef 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 JSObjectRef Function(JSContextRef ctx, int argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, int arrayType, int length, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, int arrayType, JSObjectRef buffer, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, int arrayType, JSObjectRef buffer, int byteOffset, int length, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, int arrayType, Pointer<Void> bytes, int byteLength, Pointer<NativeFunction<JSTypedArrayBytesDeallocator_>> bytesDeallocator, Pointer<Void> deallocatorContext, Pointer<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 (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 bool Function(JSObjectRef object, Pointer<Void> 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(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, int attributes, Pointer<JSValueRef> 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(JSContextRef ctx, JSObjectRef object, int propertyIndex, JSValueRef value, Pointer<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 (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(JSContextRef ctx, JSObjectRef object, JSValueRef propertyKey, JSValueRef value, int attributes, Pointer<JSValueRef> 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(JSContextRef ctx, JSObjectRef object, JSValueRef 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(JSPropertyNameAccumulatorRef accumulator, JSStringRef 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(JSPropertyNameArrayRef 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 JSStringRef Function(JSPropertyNameArrayRef 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(JSPropertyNameArrayRef array)
Releases a JavaScript property name array. array (JSPropertyNameArrayRef) The JSPropetyNameArray to release.
final
JSPropertyNameArrayReleaseAddress Pointer<NativeFunction<Void Function(JSPropertyNameArrayRef)>>
final
JSPropertyNameArrayRetain JSPropertyNameArrayRef Function(JSPropertyNameArrayRef 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 JSStringRef Function(Pointer<JSChar> chars, int 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 JSStringRef 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<JSChar> Function(JSStringRef 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(JSStringRef 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(JSStringRef 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(JSStringRef string, Pointer<JSChar> 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 bool Function(JSStringRef a, JSStringRef 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 bool Function(JSStringRef a, Pointer<Utf8> 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(JSStringRef string)
Releases a JavaScript string. string (JSStringRef) The JSString to release.
final
JSStringReleaseAddress Pointer<NativeFunction<Void Function(JSStringRef)>>
final
JSStringRetain JSStringRef Function(JSStringRef string)
Retains a JavaScript string. string (JSStringRef) The JSString to retain. @result (JSStringRef) A JSString that is the same as string.
final
JSValueCreateJSONString JSStringRef Function(JSContextRef ctx, JSValueRef value, int indent, Pointer<JSValueRef> 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(JSContextRef ctx, JSValueRef 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(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef a, JSValueRef b, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef value, JSClassRef 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 bool Function(JSContextRef ctx, JSValueRef a, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 JSValueRef Function(JSContextRef ctx, bool 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef ctx)
Creates a JavaScript value of the null type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique null value.
final
JSValueMakeNumber JSValueRef Function(JSContextRef 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef 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(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.
final
JSValueToBoolean bool Function(JSContextRef ctx, JSValueRef 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(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 JSStringRef Function(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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(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 (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to unprotect.
final
kLookup LookupFunc
final

Typedefs

JSChar = UnsignedChar
JSClassDefinitionRef = Pointer<JSClassDefinition_>
JSClassRef = Pointer<JSClass_>
JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior.
JSContextGroupRef = Pointer<JSContextGroup_>
JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects.
JSContextRef = Pointer<JSContext_>
JSContextRef A JavaScript execution context. Holds the global object and other execution state.
JSGlobalContextRef = JSContextRef
JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext.
JSObjectCallAsConstructorCallback_ = JSObjectRef Function(JSContextRef ctx, JSObjectRef constructor, Size argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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:
JSObjectCallAsFunctionCallback_ = JSValueRef Function(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, Size argumentCount, Pointer<JSValueRef> arguments, Pointer<JSValueRef> 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:
JSObjectConvertToTypeCallback_ = JSValueRef Function(JSContextRef ctx, JSObjectRef object, Int8 type, Pointer<JSValueRef> 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:
JSObjectDeletePropertyCallback_ = Bool Function(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, Pointer<JSValueRef> 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:
JSObjectFinalizeCallback_ = Void Function(JSObjectRef 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:
JSObjectGetPropertyCallback_ = JSValueRef Function(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, Pointer<JSValueRef> 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:
JSObjectGetPropertyNamesCallback_ = Void Function(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef 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:
JSObjectHasInstanceCallback_ = Bool Function(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, Pointer<JSValueRef> 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:
JSObjectHasPropertyCallback_ = Bool Function(JSContextRef ctx, JSObjectRef object, JSStringRef 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:
JSObjectInitializeCallback_ = Void Function(JSContextRef ctx, JSObjectRef 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:
JSObjectRef = Pointer<JSValue_>
JSObjectRef A JavaScript object. A JSObject is a JSValue.
JSObjectSetPropertyCallback_ = Bool Function(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, Pointer<JSValueRef> 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:
JSPropertyNameAccumulatorRef = Pointer<JSPropertyNameAccumulator_>
JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties.
JSPropertyNameArrayRef = Pointer<JSPropertyNameArray_>
JSPropertyNameArrayRef An array of JavaScript property names.
JSStaticFunctionRef = Pointer<JSStaticFunction_>
JSStaticValueRef = Pointer<JSStaticValue_>
JSStringRef = Pointer<JSString_>
JSStringRef A UTF16 character buffer. The fundamental string representation in JavaScript.
JSTypedArrayBytesDeallocator = void Function(Uint8List bytes, Uint8List deallocatorContext)
JSTypedArrayBytesDeallocator_ = Void Function(Pointer<Void> bytes, Pointer<Void> 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.
JSValueRef = Pointer<JSValue_>
JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them.