Crate javascriptcore_sys

Source
Expand description

This crate provides raw bindings for the JavaScriptCore public API. It is a pretty direct mapping of the underlying C API provided by JavaScriptCore.

Structs§

JSClassDefinition
Contains properties and callbacks that define a type of object.
JSStaticFunction
A statically declared function property.
JSStaticValue
A statically declared value property.

Enums§

JSType
A constant identifying the type of a JSValueRef.
JSTypedArrayType
A constant identifying the Typed Array type of a JSObjectRef.

Constants§

kJSClassAttributeNoAutomaticPrototype
Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually.
kJSClassAttributeNone
Specifies that a class has no special attributes.
kJSPropertyAttributeDontDelete
Specifies that the delete operation should fail on a property.
kJSPropertyAttributeDontEnum
Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops.
kJSPropertyAttributeNone
Specifies that a property has no special attributes.
kJSPropertyAttributeReadOnly
Specifies that a property is read-only.

Functions§

JSCheckScriptSyntax
Checks for syntax errors in a string of JavaScript.
JSClassCreate
Creates a JavaScript class suitable for use with JSObjectMake.
JSClassRelease
Releases a JavaScript class.
JSClassRetain
Retains a JavaScript class.
JSContextGetGlobalContext
Gets the global context of a JavaScript execution context.
JSContextGetGlobalObject
Gets the global object of a JavaScript execution context.
JSContextGetGroup
Gets the context group to which a JavaScript execution context belongs.
JSContextGroupCreate
Creates a JavaScript context group.
JSContextGroupRelease
Releases a JavaScript context group.
JSContextGroupRetain
Retains a JavaScript context group.
JSEvaluateScript
Evaluates a string of JavaScript.
JSGarbageCollect
Performs a JavaScript garbage collection.
JSGlobalContextCopyName
Gets a copy of the name of a context.
JSGlobalContextCreate
Creates a global JavaScript execution context.
JSGlobalContextCreateInGroup
Creates a global JavaScript execution context in the context group provided.
JSGlobalContextRelease
Releases a global JavaScript execution context.
JSGlobalContextRetain
Retains a global JavaScript execution context.
JSGlobalContextSetName
Sets the remote debugging name for a context.
JSObjectCallAsConstructor
Calls an object as a constructor.
JSObjectCallAsFunction
Calls an object as a function.
JSObjectCopyPropertyNames
Gets the names of an object’s enumerable properties.
JSObjectDeleteProperty
Deletes a property from an object.
JSObjectDeletePropertyForKey
Deletes a property from an object using a JSValueRef as the property key.
JSObjectGetArrayBufferByteLength
Returns the number of bytes in a JavaScript data object.
JSObjectGetArrayBufferBytesPtr
Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
JSObjectGetPrivate
Gets an object’s private data.
JSObjectGetProperty
Gets a property from an object.
JSObjectGetPropertyAtIndex
Gets a property from an object by numeric index.
JSObjectGetPropertyForKey
Gets a property from an object using a JSValueRef as the property key.
JSObjectGetPrototype
Gets an object’s prototype.
JSObjectGetTypedArrayBuffer
Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteLength
Returns the byte length of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteOffset
Returns the byte offset of a JavaScript Typed Array object.
JSObjectGetTypedArrayBytesPtr
Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
JSObjectGetTypedArrayLength
Returns the length of a JavaScript Typed Array object.
JSObjectHasProperty
Tests whether an object has a given property.
JSObjectHasPropertyForKey
Tests whether an object has a given property using a JSValueRef as the property key.
JSObjectIsConstructor
Tests whether an object can be called as a constructor.
JSObjectIsFunction
Tests whether an object can be called as a function.
JSObjectMake
Creates a JavaScript object.
JSObjectMakeArray
Creates a JavaScript Array object.
JSObjectMakeArrayBufferWithBytesNoCopy
Creates a JavaScript Array Buffer object from an existing pointer.
JSObjectMakeConstructor
Convenience method for creating a JavaScript constructor.
JSObjectMakeDate
Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
JSObjectMakeDeferredPromise
Creates a JavaScript promise object by invoking the provided executor.
JSObjectMakeError
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
JSObjectMakeFunction
Creates a function with a given script as its body.
JSObjectMakeFunctionWithCallback
Convenience method for creating a JavaScript function with a given callback as its implementation.
JSObjectMakeRegExp
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
JSObjectMakeTypedArray
Creates a JavaScript Typed Array object with the given number of elements.
JSObjectMakeTypedArrayWithArrayBuffer
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
JSObjectMakeTypedArrayWithArrayBufferAndOffset
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.
JSObjectMakeTypedArrayWithBytesNoCopy
Creates a JavaScript Typed Array object from an existing pointer.
JSObjectSetPrivate
Sets a pointer to private data on an object.
JSObjectSetProperty
Sets a property on an object.
JSObjectSetPropertyAtIndex
Sets a property on an object by numeric index.
JSObjectSetPropertyForKey
Sets a property on an object using a JSValueRef as the property key.
JSObjectSetPrototype
Sets an object’s prototype.
JSPropertyNameAccumulatorAddName
Adds a property name to a JavaScript property name accumulator.
JSPropertyNameArrayGetCount
Gets a count of the number of items in a JavaScript property name array.
JSPropertyNameArrayGetNameAtIndex
Gets a property name at a given index in a JavaScript property name array.
JSPropertyNameArrayRelease
Releases a JavaScript property name array.
JSPropertyNameArrayRetain
Retains a JavaScript property name array.
JSStringCreateWithCharacters
Creates a JavaScript string from a buffer of Unicode characters.
JSStringCreateWithUTF8CString
Creates a JavaScript string from a null-terminated UTF8 string.
JSStringGetCharactersPtr
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
JSStringGetLength
Returns the number of Unicode characters in a JavaScript string.
JSStringGetMaximumUTF8CStringSize
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
JSStringGetUTF8CString
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
JSStringIsEqual
Tests whether two JavaScript strings match.
JSStringIsEqualToUTF8CString
Tests whether a JavaScript string matches a null-terminated UTF8 string.
JSStringRelease
Releases a JavaScript string.
JSStringRetain
Retains a JavaScript string.
JSValueCreateJSONString
Creates a JavaScript string containing the JSON serialized representation of a JS value.
JSValueGetType
Returns a JavaScript value’s type.
JSValueGetTypedArrayType
Returns a JavaScript value’s Typed Array type.
JSValueIsArray
Tests whether a JavaScript value is an array.
JSValueIsBoolean
Tests whether a JavaScript value’s type is the boolean type.
JSValueIsDate
Tests whether a JavaScript value is a date.
JSValueIsEqual
Tests whether two JavaScript values are equal, as compared by the JS == operator.
JSValueIsInstanceOfConstructor
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
JSValueIsNull
Tests whether a JavaScript value’s type is the null type.
JSValueIsNumber
Tests whether a JavaScript value’s type is the number type.
JSValueIsObject
Tests whether a JavaScript value’s type is the object type.
JSValueIsObjectOfClass
Tests whether a JavaScript value is an object with a given class in its class chain.
JSValueIsStrictEqual
Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
JSValueIsString
Tests whether a JavaScript value’s type is the string type.
JSValueIsSymbol
Tests whether a JavaScript value’s type is the symbol type.
JSValueIsUndefined
Tests whether a JavaScript value’s type is the undefined type.
JSValueMakeBoolean
Creates a JavaScript value of the boolean type.
JSValueMakeFromJSONString
Creates a JavaScript value from a JSON formatted string.
JSValueMakeNull
Creates a JavaScript value of the null type.
JSValueMakeNumber
Creates a JavaScript value of the number type.
JSValueMakeString
Creates a JavaScript value of the string type.
JSValueMakeSymbol
Creates a JavaScript value of the symbol type.
JSValueMakeUndefined
Creates a JavaScript value of the undefined type.
JSValueProtect
Protects a JavaScript value from garbage collection.
JSValueToBoolean
Converts a JavaScript value to boolean and returns the resulting boolean.
JSValueToNumber
Converts a JavaScript value to number and returns the resulting number.
JSValueToObject
Converts a JavaScript value to object and returns the resulting object.
JSValueToStringCopy
Converts a JavaScript value to string and copies the result into a JavaScript string.
JSValueUnprotect
Unprotects a JavaScript value from garbage collection.

Type Aliases§

JSChar
A UTF-16 code unit.
JSClassAttributes
A set of JSClassAttributes.
JSClassRef
A JavaScript class. Used with JSObjectMake to construct objects with custom behavior.
JSContextGroupRef
A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects.
JSContextRef
A JavaScript execution context. Holds the global object and other execution state.
JSGlobalContextRef
A global JavaScript execution context. A JSGlobalContextRef is a JSContextRef.
JSObjectCallAsConstructorCallback
The callback invoked when an object is used as a constructor in a new expression.
JSObjectCallAsFunctionCallback
The callback invoked when an object is called as a function.
JSObjectConvertToTypeCallback
The callback invoked when converting an object to a particular JavaScript type.
JSObjectDeletePropertyCallback
The callback invoked when deleting a property.
JSObjectFinalizeCallback
The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
JSObjectGetPropertyCallback
The callback invoked when getting a property’s value.
JSObjectGetPropertyNamesCallback
The callback invoked when collecting the names of an object’s properties.
JSObjectHasInstanceCallback
The callback invoked when an object is used as the target of an instanceof expression.
JSObjectHasPropertyCallback
The callback invoked when determining whether an object has a property.
JSObjectInitializeCallback
The callback invoked when an object is first created.
JSObjectRef
A JavaScript object. A JSObjectRef is a JSValueRef.
JSObjectSetPropertyCallback
The callback invoked when setting a property’s value.
JSPropertyAttributes
A set of JSPropertyAttributes.
JSPropertyNameAccumulatorRef
An ordered set used to collect the names of a JavaScript object’s properties.
JSPropertyNameArrayRef
An array of JavaScript property names.
JSStringRef
A UTF16 character buffer. The fundamental string representation in JavaScript.
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
A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them.