Expand description
§Bindings to the JavaScriptCore framework
See Apple’s docs and the general docs on framework crates for more information.
Structs§
- JSClass
Definition JSBaseandJSObjectRefandJSValueRef - 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. Field: version The version number of this structure. The current version is 0. Field: attributes A logically ORed set of JSClassAttributes to give to the class. Field: className A null-terminated UTF8 string containing the class’s name. Field: parentClass A JSClass to set as the class’s parent class. Pass NULL use the default object class. Field: staticValues A JSStaticValue array containing the class’s statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL. Field: staticFunctions A JSStaticFunction array containing the class’s statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL. Field: initialize The callback invoked when an object is first created. Use this callback to initialize the object. Field: finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup. Field: hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property’s existence needs to be known, not its value, and computing its value is expensive. Field: getProperty The callback invoked when getting a property’s value. Field: setProperty The callback invoked when setting a property’s value. Field: deleteProperty The callback invoked when deleting a property. Field: getPropertyNames The callback invoked when collecting the names of an object’s properties. Field: callAsFunction The callback invoked when an object is called as a function. Field: hasInstance The callback invoked when an object is used as the target of an ‘instanceof’ expression. Field: callAsConstructor The callback invoked when an object is used as a constructor in a ‘new’ expression. Field: convertToType The callback invoked when converting an object to a particular JavaScript type.
- JSContext
JSContextandobjc2 - A JSContext is a JavaScript execution environment. All JavaScript execution takes place within a context, and all JavaScript values are tied to a context.
- JSManaged
Value JSManagedValueandobjc2 - JSManagedValue represents a “conditionally retained” JSValue. “Conditionally retained” means that as long as the JSManagedValue’s JSValue is reachable through the JavaScript object graph, or through the Objective-C object graph reported to the JSVirtualMachine using addManagedReference:withOwner:, the corresponding JSValue will be retained. However, if neither graph reaches the JSManagedValue, the corresponding JSValue will be released and set to nil.
- JSRelation
Condition JSValueRef - A constant identifying the type of JavaScript relation condition.
- JSStatic
Function JSBaseandJSObjectRef - This structure describes a statically declared function property. Field: name A null-terminated UTF8 string containing the property’s name. Field: callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function. Field: attributes A logically ORed set of JSPropertyAttributes to give to the property.
- JSStatic
Value JSBaseandJSObjectRef - This structure describes a statically declared value property. Field: name A null-terminated UTF8 string containing the property’s name. Field: getProperty A JSObjectGetPropertyCallback to invoke when getting the property’s value. Field: setProperty A JSObjectSetPropertyCallback to invoke when setting the property’s value. May be NULL if the ReadOnly attribute is set. Field: attributes A logically ORed set of JSPropertyAttributes to give to the property.
- JSType
JSValueRef - A constant identifying the type of a JSValue.
- JSTyped
Array Type JSValueRef - A constant identifying the Typed Array type of a JSObjectRef.
- JSValue
JSValueandobjc2 - A JSValue is a reference to a JavaScript value. Every JSValue originates from a JSContext and holds a strong reference to it. When a JSValue instance method creates a new JSValue, the new value originates from the same JSContext.
- JSVirtual
Machine JSVirtualMachineandobjc2 - An instance of JSVirtualMachine represents a single JavaScript “object space” or set of execution resources. Thread safety is supported by locking the virtual machine, with concurrent JavaScript execution supported by allocating separate instances of JSVirtualMachine.
- OpaqueJS
Class JSBase - Apple’s documentation
- OpaqueJS
Context JSBase - Apple’s documentation
- OpaqueJS
Context Group JSBase - Apple’s documentation
- OpaqueJS
Property Name Accumulator JSBase - Apple’s documentation
- OpaqueJS
Property Name Array JSBase - Apple’s documentation
- OpaqueJS
String JSBase - Apple’s documentation
- OpaqueJS
Value JSBase - Apple’s documentation
Constants§
- kJSClass
Attribute NoAutomatic Prototype JSObjectRef - Apple’s documentation
- kJSClass
Attribute None JSObjectRef - Apple’s documentation
- kJSProperty
Attribute Dont Delete JSObjectRef - Apple’s documentation
- kJSProperty
Attribute Dont Enum JSObjectRef - Apple’s documentation
- kJSProperty
Attribute None JSObjectRef - Apple’s documentation
- kJSProperty
Attribute Read Only JSObjectRef - Apple’s documentation
Statics§
- JSProperty
Descriptor ⚠Configurable Key JSValueandobjc2-foundation - Apple’s documentation
- JSProperty
Descriptor ⚠Enumerable Key JSValueandobjc2-foundation - Apple’s documentation
- JSProperty
Descriptor ⚠GetKey JSValueandobjc2-foundation - Apple’s documentation
- JSProperty
Descriptor ⚠SetKey JSValueandobjc2-foundation - Apple’s documentation
- JSProperty
Descriptor ⚠Value Key JSValueandobjc2-foundation - Apple’s documentation
- JSProperty
Descriptor ⚠Writable Key JSValueandobjc2-foundation - Property Descriptor Constants
- kJSClass
Definition ⚠Empty JSBaseandJSObjectRefandJSValueRef - A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.
Traits§
- JSExport
JSExportandobjc2 - JSExport provides a declarative way to export Objective-C objects and classes – including properties, instance methods, class methods, and initializers – to JavaScript.
Functions§
- JSBig
IntCreate ⚠With Double JSBaseandJSValueRef - Creates a JavaScript BigInt with a double.
- JSBig
IntCreate ⚠With Int64 JSBaseandJSValueRef - Creates a JavaScript BigInt with a 64-bit signed integer.
- JSBig
IntCreate ⚠With String JSBaseandJSValueRef - Creates a JavaScript BigInt with an integer represented in string.
- JSBig
IntCreate ⚠WithU Int64 JSBaseandJSValueRef - Creates a JavaScript BigInt with a 64-bit unsigned integer.
- JSCheck
Script ⚠Syntax JSBase - Checks for syntax errors in a string of JavaScript.
- JSClass
Create ⚠JSBaseandJSObjectRefandJSValueRef - Creates a JavaScript class suitable for use with JSObjectMake.
- JSClass
Release ⚠JSBaseandJSObjectRef - Releases a JavaScript class.
- JSClass
Retain ⚠JSBaseandJSObjectRef - Retains a JavaScript class.
- JSContext
GetGlobal ⚠Context Deprecated JSBaseandJSContextRef - JSContext
GetGlobal ⚠Object Deprecated JSBaseandJSContextRef - JSContext
GetGroup ⚠Deprecated JSBaseandJSContextRef - JSContext
Group ⚠Create Deprecated JSBaseandJSContextRef - JSContext
Group ⚠Release Deprecated JSBaseandJSContextRef - JSContext
Group ⚠Retain Deprecated JSBaseandJSContextRef - JSEvaluate
Script ⚠JSBase - Evaluates a string of JavaScript.
- JSGarbage
Collect ⚠JSBase - Performs a JavaScript garbage collection.
- JSGlobal
Context ⚠Copy Name JSBaseandJSContextRef - Gets a copy of the name of a context.
- JSGlobal
Context ⚠Create JSBaseandJSContextRef - Creates a global JavaScript execution context.
- JSGlobal
Context ⚠Create InGroup JSBaseandJSContextRef - Creates a global JavaScript execution context in the context group provided.
- JSGlobal
Context ⚠IsInspectable JSBaseandJSContextRef - Gets whether the context is inspectable in Web Inspector.
- JSGlobal
Context ⚠Release JSBaseandJSContextRef - Releases a global JavaScript execution context.
- JSGlobal
Context ⚠Retain JSBaseandJSContextRef - Retains a global JavaScript execution context.
- JSGlobal
Context ⚠SetInspectable JSBaseandJSContextRef - Sets whether the context is inspectable in Web Inspector. Default value is NO.
- JSGlobal
Context ⚠SetName JSBaseandJSContextRef - Sets the name exposed when inspecting a context.
- JSObject
Call ⚠AsConstructor JSBaseandJSObjectRef - Calls an object as a constructor.
- JSObject
Call ⚠AsFunction JSBaseandJSObjectRef - Calls an object as a function.
- JSObject
Copy ⚠Property Names JSBaseandJSObjectRef - Gets the names of an object’s enumerable properties.
- JSObject
Delete ⚠Property JSBaseandJSObjectRef - Deletes a property from an object.
- JSObject
Delete ⚠Property ForKey JSBaseandJSObjectRef - Deletes a property from an object using a JSValueRef as the property key.
- JSObject
GetArray ⚠Buffer Byte Length JSBaseandJSTypedArray - Returns the number of bytes in a JavaScript data object.
- JSObject
GetArray ⚠Buffer Bytes Ptr JSBaseandJSTypedArray - Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
- JSObject
GetPrivate ⚠JSBaseandJSObjectRef - Gets an object’s private data.
- JSObject
GetProperty ⚠JSBaseandJSObjectRef - Gets a property from an object.
- JSObject
GetProperty ⚠AtIndex JSBaseandJSObjectRef - Gets a property from an object by numeric index.
- JSObject
GetProperty ⚠ForKey JSBaseandJSObjectRef - Gets a property from an object using a JSValueRef as the property key.
- JSObject
GetPrototype ⚠JSBaseandJSObjectRef - Gets an object’s prototype.
- JSObject
GetTyped ⚠Array Buffer JSBaseandJSTypedArray - Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Length JSBaseandJSTypedArray - Returns the byte length of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Offset JSBaseandJSTypedArray - Returns the byte offset of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Bytes Ptr JSBaseandJSTypedArray - Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Length JSBaseandJSTypedArray - Returns the length of a JavaScript Typed Array object.
- JSObject
HasProperty ⚠JSBaseandJSObjectRef - Tests whether an object has a given property.
- JSObject
HasProperty ⚠ForKey JSBaseandJSObjectRef - Tests whether an object has a given property using a JSValueRef as the property key.
- JSObject
IsConstructor ⚠JSBaseandJSObjectRef - Tests whether an object can be called as a constructor.
- JSObject
IsFunction ⚠JSBaseandJSObjectRef - Tests whether an object can be called as a function.
- JSObject
Make ⚠JSBaseandJSObjectRef - Creates a JavaScript object.
- JSObject
Make ⚠Array JSBaseandJSObjectRef - Creates a JavaScript Array object.
- JSObject
Make ⚠Array Buffer With Bytes NoCopy JSBaseandJSTypedArray - Creates a JavaScript Array Buffer object from an existing pointer.
- JSObject
Make ⚠Constructor JSBaseandJSObjectRef - Convenience method for creating a JavaScript constructor.
- JSObject
Make ⚠Date JSBaseandJSObjectRef - Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
- JSObject
Make ⚠Deferred Promise JSBaseandJSObjectRef - Creates a JavaScript promise object by invoking the provided executor.
- JSObject
Make ⚠Error JSBaseandJSObjectRef - Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
- JSObject
Make ⚠Function JSBaseandJSObjectRef - Creates a function with a given script as its body.
- JSObject
Make ⚠Function With Callback JSBaseandJSObjectRef - Convenience method for creating a JavaScript function with a given callback as its implementation.
- JSObject
Make ⚠RegExp JSBaseandJSObjectRef - Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
- JSObject
Make ⚠Typed Array JSBaseandJSTypedArrayandJSValueRef - Creates a JavaScript Typed Array object with the given number of elements.
- JSObject
Make ⚠Typed Array With Array Buffer JSBaseandJSTypedArrayandJSValueRef - Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
- JSObject
Make ⚠Typed Array With Array Buffer AndOffset JSBaseandJSTypedArrayandJSValueRef - 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 JSBaseandJSTypedArrayandJSValueRef - Creates a JavaScript Typed Array object from an existing pointer.
- JSObject
SetPrivate ⚠JSBaseandJSObjectRef - Sets a pointer to private data on an object.
- JSObject
SetProperty ⚠JSBaseandJSObjectRef - Sets a property on an object.
- JSObject
SetProperty ⚠AtIndex JSBaseandJSObjectRef - Sets a property on an object by numeric index.
- JSObject
SetProperty ⚠ForKey JSBaseandJSObjectRef - Sets a property on an object using a JSValueRef as the property key.
- JSObject
SetPrototype ⚠JSBaseandJSObjectRef - Sets an object’s prototype.
- JSProperty
Name ⚠Accumulator AddName JSBaseandJSObjectRef - Adds a property name to a JavaScript property name accumulator.
- JSProperty
Name ⚠Array GetCount JSBaseandJSObjectRef - Gets a count of the number of items in a JavaScript property name array.
- JSProperty
Name ⚠Array GetName AtIndex JSBaseandJSObjectRef - Gets a property name at a given index in a JavaScript property name array.
- JSProperty
Name ⚠Array Release JSBaseandJSObjectRef - Releases a JavaScript property name array.
- JSProperty
Name ⚠Array Retain JSBaseandJSObjectRef - Retains a JavaScript property name array.
- JSString
CopyCF ⚠String JSBaseandJSStringRefCFandobjc2-core-foundation - Creates a CFString from a JavaScript string.
- JSString
Create ⚠WithCF String JSBaseandJSStringRefCFandobjc2-core-foundation - Creates a JavaScript string from a CFString.
- JSString
Create ⚠With Characters JSBaseandJSStringRef - Creates a JavaScript string from a buffer of Unicode characters.
- JSString
Create ⚠WithUT F8CString JSBaseandJSStringRef - Creates a JavaScript string from a null-terminated UTF8 string.
- JSString
GetCharacters ⚠Ptr JSBaseandJSStringRef - Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
- JSString
GetLength ⚠JSBaseandJSStringRef - Returns the number of Unicode characters in a JavaScript string.
- JSString
GetMaximumUT ⚠F8CString Size JSBaseandJSStringRef - Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
- JSString
GetUT ⚠F8CString JSBaseandJSStringRef - Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
- JSString
IsEqual ⚠JSBaseandJSStringRef - Tests whether two JavaScript strings match.
- JSString
IsEqual ⚠ToUT F8CString JSBaseandJSStringRef - Tests whether a JavaScript string matches a null-terminated UTF8 string.
- JSString
Release ⚠JSBaseandJSStringRef - Releases a JavaScript string.
- JSString
Retain ⚠JSBaseandJSStringRef - Retains a JavaScript string.
- JSValue
Compare ⚠Deprecated JSBaseandJSValueRef - JSValue
Compare ⚠Double Deprecated JSBaseandJSValueRef - JSValue
Compare ⚠Int64 Deprecated JSBaseandJSValueRef - JSValue
CompareU ⚠Int64 Deprecated JSBaseandJSValueRef - JSValue
CreateJSON ⚠String Deprecated JSBaseandJSValueRef - JSValue
GetType ⚠Deprecated JSBaseandJSValueRef - JSValue
GetTyped ⚠Array Type Deprecated JSBaseandJSValueRef - JSValue
IsArray ⚠Deprecated JSBaseandJSValueRef - JSValue
IsBig ⚠Int Deprecated JSBaseandJSValueRef - JSValue
IsBoolean ⚠Deprecated JSBaseandJSValueRef - JSValue
IsDate ⚠Deprecated JSBaseandJSValueRef - JSValue
IsEqual ⚠Deprecated JSBaseandJSValueRef - JSValue
IsInstance ⚠OfConstructor Deprecated JSBaseandJSValueRef - JSValue
IsNull ⚠Deprecated JSBaseandJSValueRef - JSValue
IsNumber ⚠Deprecated JSBaseandJSValueRef - JSValue
IsObject ⚠Deprecated JSBaseandJSValueRef - JSValue
IsObject ⚠OfClass Deprecated JSBaseandJSValueRef - JSValue
IsStrict ⚠Equal Deprecated JSBaseandJSValueRef - JSValue
IsString ⚠Deprecated JSBaseandJSValueRef - JSValue
IsSymbol ⚠Deprecated JSBaseandJSValueRef - JSValue
IsUndefined ⚠Deprecated JSBaseandJSValueRef - JSValue
Make ⚠Boolean Deprecated JSBaseandJSValueRef - JSValue
Make ⚠FromJSON String Deprecated JSBaseandJSValueRef - JSValue
Make ⚠Null Deprecated JSBaseandJSValueRef - JSValue
Make ⚠Number Deprecated JSBaseandJSValueRef - JSValue
Make ⚠String Deprecated JSBaseandJSValueRef - JSValue
Make ⚠Symbol Deprecated JSBaseandJSValueRef - JSValue
Make ⚠Undefined Deprecated JSBaseandJSValueRef - JSValue
Protect ⚠Deprecated JSBaseandJSValueRef - JSValue
ToBoolean ⚠Deprecated JSBaseandJSValueRef - JSValue
ToInt32 ⚠Deprecated JSBaseandJSValueRef - JSValue
ToInt64 ⚠Deprecated JSBaseandJSValueRef - JSValue
ToNumber ⚠Deprecated JSBaseandJSValueRef - JSValue
ToObject ⚠Deprecated JSBaseandJSValueRef - JSValue
ToString ⚠Copy Deprecated JSBaseandJSValueRef - JSValue
ToUInt32 ⚠Deprecated JSBaseandJSValueRef - JSValue
ToUInt64 ⚠Deprecated JSBaseandJSValueRef - JSValue
Unprotect ⚠Deprecated JSBaseandJSValueRef
Type Aliases§
- JSChar
JSStringRef - A UTF-16 code unit. One, or a sequence of two, can encode any Unicode character. As with all scalar types, endianness depends on the underlying architecture.
- JSClass
Attributes JSObjectRef - A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.
- JSClass
Ref JSBase - Apple’s documentation
- JSContext
Group Ref JSBase - Apple’s documentation
- JSContext
Ref JSBase - Apple’s documentation
- JSGlobal
Context Ref JSBase - Apple’s documentation
- JSObject
Call AsConstructor Callback JSBaseandJSObjectRef - The callback invoked when an object is used as a constructor in a ‘new’ expression.
- JSObject
Call AsFunction Callback JSBaseandJSObjectRef - The callback invoked when an object is called as a function.
- JSObject
Convert ToType Callback JSBaseandJSObjectRefandJSValueRef - The callback invoked when converting an object to a particular JavaScript type.
- JSObject
Delete Property Callback JSBaseandJSObjectRef - The callback invoked when deleting a property.
- JSObject
Finalize Callback JSBaseandJSObjectRef - The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
- JSObject
GetProperty Callback JSBaseandJSObjectRef - The callback invoked when getting a property’s value.
- JSObject
GetProperty Names Callback JSBaseandJSObjectRef - The callback invoked when collecting the names of an object’s properties.
- JSObject
HasInstance Callback JSBaseandJSObjectRef - hasInstance The callback invoked when an object is used as the target of an ‘instanceof’ expression.
- JSObject
HasProperty Callback JSBaseandJSObjectRef - The callback invoked when determining whether an object has a property.
- JSObject
Initialize Callback JSBaseandJSObjectRef - The callback invoked when an object is first created.
- JSObject
Ref JSBase - Apple’s documentation
- JSObject
SetProperty Callback JSBaseandJSObjectRef - The callback invoked when setting a property’s value.
- JSProperty
Attributes JSObjectRef - A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
- JSProperty
Name Accumulator Ref JSBase - Apple’s documentation
- JSProperty
Name Array Ref JSBase - Apple’s documentation
- JSString
Ref JSBase - Apple’s documentation
- JSTyped
Array Bytes Deallocator JSBase - Apple’s documentation
- JSValue
Property JSValueandobjc2-foundation - Apple’s documentation
- JSValue
Ref JSBase - Apple’s documentation