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§
- JSClass
Definition - Contains properties and callbacks that define a type of object.
- JSStatic
Function - A statically declared function property.
- JSStatic
Value - A statically declared value property.
Enums§
- JSType
- A constant identifying the type of a
JSValueRef
. - JSTyped
Array Type - A constant identifying the Typed Array type of a
JSObjectRef
.
Constants§
- kJSClass
Attribute NoAutomatic Prototype - Specifies that a class should not automatically generate a shared
prototype for its instance objects. Use
kJSClassAttributeNoAutomaticPrototype
in combination withJSObjectSetPrototype
to manage prototypes manually. - kJSClass
Attribute None - Specifies that a class has no special attributes.
- kJSProperty
Attribute Dont Delete - Specifies that the delete operation should fail on a property.
- kJSProperty
Attribute Dont Enum - Specifies that a property should not be enumerated by
JSPropertyEnumerators
and JavaScriptfor...in
loops. - kJSProperty
Attribute None - Specifies that a property has no special attributes.
- kJSProperty
Attribute Read Only - Specifies that a property is read-only.
Functions§
- JSCheck
Script ⚠Syntax - Checks for syntax errors in a string of JavaScript.
- JSClass
Create ⚠ - Creates a JavaScript class suitable for use with
JSObjectMake
. - JSClass
Release ⚠ - Releases a JavaScript class.
- JSClass
Retain ⚠ - Retains a JavaScript class.
- JSContext
GetGlobal ⚠Context - Gets the global context of a JavaScript execution context.
- JSContext
GetGlobal ⚠Object - Gets the global object of a JavaScript execution context.
- JSContext
GetGroup ⚠ - Gets the context group to which a JavaScript execution context belongs.
- JSContext
Group ⚠Create - Creates a JavaScript context group.
- JSContext
Group ⚠Release - Releases a JavaScript context group.
- JSContext
Group ⚠Retain - Retains a JavaScript context group.
- JSEvaluate
Script ⚠ - Evaluates a string of JavaScript.
- JSGarbage
Collect ⚠ - Performs a JavaScript garbage collection.
- JSGlobal
Context ⚠Copy Name - Gets a copy of the name of a context.
- JSGlobal
Context ⚠Create - Creates a global JavaScript execution context.
- JSGlobal
Context ⚠Create InGroup - Creates a global JavaScript execution context in the context group provided.
- JSGlobal
Context ⚠Release - Releases a global JavaScript execution context.
- JSGlobal
Context ⚠Retain - Retains a global JavaScript execution context.
- JSGlobal
Context ⚠SetName - Sets the remote debugging name for a context.
- JSObject
Call ⚠AsConstructor - Calls an object as a constructor.
- JSObject
Call ⚠AsFunction - Calls an object as a function.
- JSObject
Copy ⚠Property Names - Gets the names of an object’s enumerable properties.
- JSObject
Delete ⚠Property - Deletes a property from an object.
- JSObject
Delete ⚠Property ForKey - Deletes a property from an object using a
JSValueRef
as the property key. - JSObject
GetArray ⚠Buffer Byte Length - Returns the number of bytes in a JavaScript data object.
- JSObject
GetArray ⚠Buffer Bytes Ptr - Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
- JSObject
GetPrivate ⚠ - Gets an object’s private data.
- JSObject
GetProperty ⚠ - Gets a property from an object.
- JSObject
GetProperty ⚠AtIndex - Gets a property from an object by numeric index.
- JSObject
GetProperty ⚠ForKey - Gets a property from an object using a
JSValueRef
as the property key. - JSObject
GetPrototype ⚠ - Gets an object’s prototype.
- JSObject
GetTyped ⚠Array Buffer - Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Length - Returns the byte length of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Offset - Returns the byte offset of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Bytes Ptr - Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Length - Returns the length of a JavaScript Typed Array object.
- JSObject
HasProperty ⚠ - Tests whether an object has a given property.
- JSObject
HasProperty ⚠ForKey - Tests whether an object has a given property using a
JSValueRef
as the property key. - JSObject
IsConstructor ⚠ - Tests whether an object can be called as a constructor.
- JSObject
IsFunction ⚠ - Tests whether an object can be called as a function.
- JSObject
Make ⚠ - Creates a JavaScript object.
- JSObject
Make ⚠Array - Creates a JavaScript Array object.
- JSObject
Make ⚠Array Buffer With Bytes NoCopy - Creates a JavaScript Array Buffer object from an existing pointer.
- JSObject
Make ⚠Constructor - Convenience method for creating a JavaScript constructor.
- JSObject
Make ⚠Date - Creates a JavaScript
Date
object, as if by invoking the built-inDate
constructor. - JSObject
Make ⚠Deferred Promise - Creates a JavaScript promise object by invoking the provided executor.
- JSObject
Make ⚠Error - Creates a JavaScript
Error
object, as if by invoking the built-inError
constructor. - JSObject
Make ⚠Function - Creates a function with a given script as its body.
- JSObject
Make ⚠Function With Callback - Convenience method for creating a JavaScript function with a given callback as its implementation.
- JSObject
Make ⚠RegExp - Creates a JavaScript
RegExp
object, as if by invoking the built-inRegExp
constructor. - JSObject
Make ⚠Typed Array - Creates a JavaScript Typed Array object with the given number of elements.
- JSObject
Make ⚠Typed Array With Array Buffer - Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
- JSObject
Make ⚠Typed Array With Array Buffer AndOffset - Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.
- JSObject
Make ⚠Typed Array With Bytes NoCopy - Creates a JavaScript Typed Array object from an existing pointer.
- JSObject
SetPrivate ⚠ - Sets a pointer to private data on an object.
- JSObject
SetProperty ⚠ - Sets a property on an object.
- JSObject
SetProperty ⚠AtIndex - Sets a property on an object by numeric index.
- JSObject
SetProperty ⚠ForKey - Sets a property on an object using a
JSValueRef
as the property key. - JSObject
SetPrototype ⚠ - Sets an object’s prototype.
- JSProperty
Name ⚠Accumulator AddName - Adds a property name to a JavaScript property name accumulator.
- JSProperty
Name ⚠Array GetCount - Gets a count of the number of items in a JavaScript property name array.
- JSProperty
Name ⚠Array GetName AtIndex - Gets a property name at a given index in a JavaScript property name array.
- JSProperty
Name ⚠Array Release - Releases a JavaScript property name array.
- JSProperty
Name ⚠Array Retain - Retains a JavaScript property name array.
- JSString
Create ⚠With Characters - Creates a JavaScript string from a buffer of Unicode characters.
- JSString
Create ⚠WithUT F8CString - Creates a JavaScript string from a null-terminated UTF8 string.
- JSString
GetCharacters ⚠Ptr - Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
- JSString
GetLength ⚠ - Returns the number of Unicode characters in a JavaScript string.
- JSString
GetMaximumUT ⚠F8CString Size - Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
- JSString
GetUT ⚠F8CString - Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
- JSString
IsEqual ⚠ - Tests whether two JavaScript strings match.
- JSString
IsEqual ⚠ToUT F8CString - Tests whether a JavaScript string matches a null-terminated UTF8 string.
- JSString
Release ⚠ - Releases a JavaScript string.
- JSString
Retain ⚠ - Retains a JavaScript string.
- JSValue
CreateJSON ⚠String - Creates a JavaScript string containing the JSON serialized representation of a JS value.
- JSValue
GetType ⚠ - Returns a JavaScript value’s type.
- JSValue
GetTyped ⚠Array Type - Returns a JavaScript value’s Typed Array type.
- JSValue
IsArray ⚠ - Tests whether a JavaScript value is an
array
. - JSValue
IsBoolean ⚠ - Tests whether a JavaScript value’s type is the
boolean
type. - JSValue
IsDate ⚠ - Tests whether a JavaScript value is a
date
. - JSValue
IsEqual ⚠ - Tests whether two JavaScript values are equal, as compared by the JS
==
operator. - JSValue
IsInstance ⚠OfConstructor - Tests whether a JavaScript value is an object constructed by a
given constructor, as compared by the JS
instanceof
operator. - JSValue
IsNull ⚠ - Tests whether a JavaScript value’s type is the
null
type. - JSValue
IsNumber ⚠ - Tests whether a JavaScript value’s type is the
number
type. - JSValue
IsObject ⚠ - Tests whether a JavaScript value’s type is the
object
type. - JSValue
IsObject ⚠OfClass - Tests whether a JavaScript value is an
object
with a given class in its class chain. - JSValue
IsStrict ⚠Equal - Tests whether two JavaScript values are strict equal, as compared
by the JS
===
operator. - JSValue
IsString ⚠ - Tests whether a JavaScript value’s type is the
string
type. - JSValue
IsSymbol ⚠ - Tests whether a JavaScript value’s type is the
symbol
type. - JSValue
IsUndefined ⚠ - Tests whether a JavaScript value’s type is the
undefined
type. - JSValue
Make ⚠Boolean - Creates a JavaScript value of the
boolean
type. - JSValue
Make ⚠FromJSON String - Creates a JavaScript value from a JSON formatted string.
- JSValue
Make ⚠Null - Creates a JavaScript value of the
null
type. - JSValue
Make ⚠Number - Creates a JavaScript value of the
number
type. - JSValue
Make ⚠String - Creates a JavaScript value of the string type.
- JSValue
Make ⚠Symbol - Creates a JavaScript value of the symbol type.
- JSValue
Make ⚠Undefined - Creates a JavaScript value of the
undefined
type. - JSValue
Protect ⚠ - Protects a JavaScript value from garbage collection.
- JSValue
ToBoolean ⚠ - Converts a JavaScript value to boolean and returns the resulting boolean.
- JSValue
ToNumber ⚠ - Converts a JavaScript value to number and returns the resulting number.
- JSValue
ToObject ⚠ - Converts a JavaScript value to object and returns the resulting object.
- JSValue
ToString ⚠Copy - Converts a JavaScript value to string and copies the result into a JavaScript string.
- JSValue
Unprotect ⚠ - Unprotects a JavaScript value from garbage collection.
Type Aliases§
- JSChar
- A UTF-16 code unit.
- JSClass
Attributes - A set of
JSClassAttribute
s. - JSClass
Ref - A JavaScript class.
Used with
JSObjectMake
to construct objects with custom behavior. - JSContext
Group Ref - A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects.
- JSContext
Ref - A JavaScript execution context. Holds the global object and other execution state.
- JSGlobal
Context Ref - A global JavaScript execution context.
A
JSGlobalContextRef
is aJSContextRef
. - JSObject
Call AsConstructor Callback - The callback invoked when an object is used as a constructor in a
new
expression. - JSObject
Call AsFunction Callback - The callback invoked when an object is called as a function.
- JSObject
Convert ToType Callback - The callback invoked when converting an object to a particular JavaScript type.
- JSObject
Delete Property Callback - The callback invoked when deleting a property.
- JSObject
Finalize Callback - The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
- JSObject
GetProperty Callback - The callback invoked when getting a property’s value.
- JSObject
GetProperty Names Callback - The callback invoked when collecting the names of an object’s properties.
- JSObject
HasInstance Callback - The callback invoked when an object is used as the target
of an
instanceof
expression. - JSObject
HasProperty Callback - The callback invoked when determining whether an object has a property.
- JSObject
Initialize Callback - The callback invoked when an object is first created.
- JSObject
Ref - A JavaScript object. A
JSObjectRef
is aJSValueRef
. - JSObject
SetProperty Callback - The callback invoked when setting a property’s value.
- JSProperty
Attributes - A set of
JSPropertyAttribute
s. - JSProperty
Name Accumulator Ref - An ordered set used to collect the names of a JavaScript object’s properties.
- JSProperty
Name Array Ref - An array of JavaScript property names.
- JSString
Ref - A UTF16 character buffer. The fundamental string representation in JavaScript.
- JSTyped
Array Bytes Deallocator - 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.
- JSValue
Ref - A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them.