Expand description
§Bindings to the JavaScriptCore
framework
See Apple’s docs and the general docs on framework crates for more information.
Structs§
- JSClass
Definition JSBase
andJSObjectRef
andJSValueRef
- 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
JSContext
andobjc2
- 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 JSManagedValue
andobjc2
- 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 JSBase
andJSObjectRef
- 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 JSBase
andJSObjectRef
- 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
JSValue
andobjc2
- 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 JSVirtualMachine
andobjc2
- 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 JSValue
andobjc2-foundation
- Apple’s documentation
- JSProperty
Descriptor ⚠Enumerable Key JSValue
andobjc2-foundation
- Apple’s documentation
- JSProperty
Descriptor ⚠GetKey JSValue
andobjc2-foundation
- Apple’s documentation
- JSProperty
Descriptor ⚠SetKey JSValue
andobjc2-foundation
- Apple’s documentation
- JSProperty
Descriptor ⚠Value Key JSValue
andobjc2-foundation
- Apple’s documentation
- JSProperty
Descriptor ⚠Writable Key JSValue
andobjc2-foundation
- Property Descriptor Constants
- kJSClass
Definition ⚠Empty JSBase
andJSValueRef
andJSObjectRef
- A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.
Traits§
- JSExport
JSExport
andobjc2
- 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 JSValueRef
andJSBase
- Creates a JavaScript BigInt with a double.
- JSBig
IntCreate ⚠With Int64 JSValueRef
andJSBase
- Creates a JavaScript BigInt with a 64-bit signed integer.
- JSBig
IntCreate ⚠With String JSValueRef
andJSBase
- Creates a JavaScript BigInt with an integer represented in string.
- JSBig
IntCreate ⚠WithU Int64 JSValueRef
andJSBase
- 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 ⚠JSBase
andJSValueRef
andJSObjectRef
- Creates a JavaScript class suitable for use with JSObjectMake.
- JSClass
Release ⚠JSObjectRef
andJSBase
- Releases a JavaScript class.
- JSClass
Retain ⚠JSObjectRef
andJSBase
- Retains a JavaScript class.
- JSContext
GetGlobal ⚠Context Deprecated JSContextRef
andJSBase
- JSContext
GetGlobal ⚠Object Deprecated JSContextRef
andJSBase
- JSContext
GetGroup ⚠Deprecated JSContextRef
andJSBase
- JSContext
Group ⚠Create Deprecated JSContextRef
andJSBase
- JSContext
Group ⚠Release Deprecated JSContextRef
andJSBase
- JSContext
Group ⚠Retain Deprecated JSContextRef
andJSBase
- JSEvaluate
Script ⚠JSBase
- Evaluates a string of JavaScript.
- JSGarbage
Collect ⚠JSBase
- Performs a JavaScript garbage collection.
- JSGlobal
Context ⚠Copy Name JSContextRef
andJSBase
- Gets a copy of the name of a context.
- JSGlobal
Context ⚠Create JSContextRef
andJSBase
- Creates a global JavaScript execution context.
- JSGlobal
Context ⚠Create InGroup JSContextRef
andJSBase
- Creates a global JavaScript execution context in the context group provided.
- JSGlobal
Context ⚠IsInspectable JSContextRef
andJSBase
- Gets whether the context is inspectable in Web Inspector.
- JSGlobal
Context ⚠Release JSContextRef
andJSBase
- Releases a global JavaScript execution context.
- JSGlobal
Context ⚠Retain JSContextRef
andJSBase
- Retains a global JavaScript execution context.
- JSGlobal
Context ⚠SetInspectable JSContextRef
andJSBase
- Sets whether the context is inspectable in Web Inspector. Default value is NO.
- JSGlobal
Context ⚠SetName JSContextRef
andJSBase
- Sets the name exposed when inspecting a context.
- JSObject
Call ⚠AsConstructor JSObjectRef
andJSBase
- Calls an object as a constructor.
- JSObject
Call ⚠AsFunction JSObjectRef
andJSBase
- Calls an object as a function.
- JSObject
Copy ⚠Property Names JSObjectRef
andJSBase
- Gets the names of an object’s enumerable properties.
- JSObject
Delete ⚠Property JSObjectRef
andJSBase
- Deletes a property from an object.
- JSObject
Delete ⚠Property ForKey JSObjectRef
andJSBase
- Deletes a property from an object using a JSValueRef as the property key.
- JSObject
GetArray ⚠Buffer Byte Length JSTypedArray
andJSBase
- Returns the number of bytes in a JavaScript data object.
- JSObject
GetArray ⚠Buffer Bytes Ptr JSTypedArray
andJSBase
- Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
- JSObject
GetPrivate ⚠JSObjectRef
andJSBase
- Gets an object’s private data.
- JSObject
GetProperty ⚠JSObjectRef
andJSBase
- Gets a property from an object.
- JSObject
GetProperty ⚠AtIndex JSObjectRef
andJSBase
- Gets a property from an object by numeric index.
- JSObject
GetProperty ⚠ForKey JSObjectRef
andJSBase
- Gets a property from an object using a JSValueRef as the property key.
- JSObject
GetPrototype ⚠JSObjectRef
andJSBase
- Gets an object’s prototype.
- JSObject
GetTyped ⚠Array Buffer JSTypedArray
andJSBase
- Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Length JSTypedArray
andJSBase
- Returns the byte length of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Byte Offset JSTypedArray
andJSBase
- Returns the byte offset of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Bytes Ptr JSTypedArray
andJSBase
- Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
- JSObject
GetTyped ⚠Array Length JSTypedArray
andJSBase
- Returns the length of a JavaScript Typed Array object.
- JSObject
HasProperty ⚠JSObjectRef
andJSBase
- Tests whether an object has a given property.
- JSObject
HasProperty ⚠ForKey JSObjectRef
andJSBase
- Tests whether an object has a given property using a JSValueRef as the property key.
- JSObject
IsConstructor ⚠JSObjectRef
andJSBase
- Tests whether an object can be called as a constructor.
- JSObject
IsFunction ⚠JSObjectRef
andJSBase
- Tests whether an object can be called as a function.
- JSObject
Make ⚠JSObjectRef
andJSBase
- Creates a JavaScript object.
- JSObject
Make ⚠Array JSObjectRef
andJSBase
- Creates a JavaScript Array object.
- JSObject
Make ⚠Array Buffer With Bytes NoCopy JSTypedArray
andJSBase
- Creates a JavaScript Array Buffer object from an existing pointer.
- JSObject
Make ⚠Constructor JSObjectRef
andJSBase
- Convenience method for creating a JavaScript constructor.
- JSObject
Make ⚠Date JSObjectRef
andJSBase
- Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
- JSObject
Make ⚠Deferred Promise JSObjectRef
andJSBase
- Creates a JavaScript promise object by invoking the provided executor.
- JSObject
Make ⚠Error JSObjectRef
andJSBase
- Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
- JSObject
Make ⚠Function JSObjectRef
andJSBase
- Creates a function with a given script as its body.
- JSObject
Make ⚠Function With Callback JSObjectRef
andJSBase
- Convenience method for creating a JavaScript function with a given callback as its implementation.
- JSObject
Make ⚠RegExp JSObjectRef
andJSBase
- Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
- JSObject
Make ⚠Typed Array JSBase
andJSValueRef
andJSTypedArray
- Creates a JavaScript Typed Array object with the given number of elements.
- JSObject
Make ⚠Typed Array With Array Buffer JSBase
andJSValueRef
andJSTypedArray
- Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
- JSObject
Make ⚠Typed Array With Array Buffer AndOffset JSBase
andJSValueRef
andJSTypedArray
- 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 JSBase
andJSValueRef
andJSTypedArray
- Creates a JavaScript Typed Array object from an existing pointer.
- JSObject
SetPrivate ⚠JSObjectRef
andJSBase
- Sets a pointer to private data on an object.
- JSObject
SetProperty ⚠JSObjectRef
andJSBase
- Sets a property on an object.
- JSObject
SetProperty ⚠AtIndex JSObjectRef
andJSBase
- Sets a property on an object by numeric index.
- JSObject
SetProperty ⚠ForKey JSObjectRef
andJSBase
- Sets a property on an object using a JSValueRef as the property key.
- JSObject
SetPrototype ⚠JSObjectRef
andJSBase
- Sets an object’s prototype.
- JSProperty
Name ⚠Accumulator AddName JSObjectRef
andJSBase
- Adds a property name to a JavaScript property name accumulator.
- JSProperty
Name ⚠Array GetCount JSObjectRef
andJSBase
- Gets a count of the number of items in a JavaScript property name array.
- JSProperty
Name ⚠Array GetName AtIndex JSObjectRef
andJSBase
- Gets a property name at a given index in a JavaScript property name array.
- JSProperty
Name ⚠Array Release JSObjectRef
andJSBase
- Releases a JavaScript property name array.
- JSProperty
Name ⚠Array Retain JSObjectRef
andJSBase
- Retains a JavaScript property name array.
- JSString
CopyCF ⚠String JSBase
andJSStringRefCF
andobjc2-core-foundation
- Creates a CFString from a JavaScript string.
- JSString
Create ⚠WithCF String JSBase
andobjc2-core-foundation
andJSStringRefCF
- Creates a JavaScript string from a CFString.
- JSString
Create ⚠With Characters JSStringRef
andJSBase
- Creates a JavaScript string from a buffer of Unicode characters.
- JSString
Create ⚠WithUT F8CString JSStringRef
andJSBase
- Creates a JavaScript string from a null-terminated UTF8 string.
- JSString
GetCharacters ⚠Ptr JSStringRef
andJSBase
- Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
- JSString
GetLength ⚠JSStringRef
andJSBase
- Returns the number of Unicode characters in a JavaScript string.
- JSString
GetMaximumUT ⚠F8CString Size JSStringRef
andJSBase
- Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
- JSString
GetUT ⚠F8CString JSStringRef
andJSBase
- Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
- JSString
IsEqual ⚠JSStringRef
andJSBase
- Tests whether two JavaScript strings match.
- JSString
IsEqual ⚠ToUT F8CString JSStringRef
andJSBase
- Tests whether a JavaScript string matches a null-terminated UTF8 string.
- JSString
Release ⚠JSStringRef
andJSBase
- Releases a JavaScript string.
- JSString
Retain ⚠JSStringRef
andJSBase
- Retains a JavaScript string.
- JSValue
Compare ⚠Deprecated JSValueRef
andJSBase
- JSValue
Compare ⚠Double Deprecated JSValueRef
andJSBase
- JSValue
Compare ⚠Int64 Deprecated JSValueRef
andJSBase
- JSValue
CompareU ⚠Int64 Deprecated JSValueRef
andJSBase
- JSValue
CreateJSON ⚠String Deprecated JSValueRef
andJSBase
- JSValue
GetType ⚠Deprecated JSValueRef
andJSBase
- JSValue
GetTyped ⚠Array Type Deprecated JSValueRef
andJSBase
- JSValue
IsArray ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsBig ⚠Int Deprecated JSValueRef
andJSBase
- JSValue
IsBoolean ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsDate ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsEqual ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsInstance ⚠OfConstructor Deprecated JSValueRef
andJSBase
- JSValue
IsNull ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsNumber ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsObject ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsObject ⚠OfClass Deprecated JSValueRef
andJSBase
- JSValue
IsStrict ⚠Equal Deprecated JSValueRef
andJSBase
- JSValue
IsString ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsSymbol ⚠Deprecated JSValueRef
andJSBase
- JSValue
IsUndefined ⚠Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠Boolean Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠FromJSON String Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠Null Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠Number Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠String Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠Symbol Deprecated JSValueRef
andJSBase
- JSValue
Make ⚠Undefined Deprecated JSValueRef
andJSBase
- JSValue
Protect ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToBoolean ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToInt32 ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToInt64 ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToNumber ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToObject ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToString ⚠Copy Deprecated JSValueRef
andJSBase
- JSValue
ToUInt32 ⚠Deprecated JSValueRef
andJSBase
- JSValue
ToUInt64 ⚠Deprecated JSValueRef
andJSBase
- JSValue
Unprotect ⚠Deprecated JSValueRef
andJSBase
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 JSBase
andJSObjectRef
- The callback invoked when an object is used as a constructor in a ‘new’ expression.
- JSObject
Call AsFunction Callback JSBase
andJSObjectRef
- The callback invoked when an object is called as a function.
- JSObject
Convert ToType Callback JSBase
andJSObjectRef
andJSValueRef
- The callback invoked when converting an object to a particular JavaScript type.
- JSObject
Delete Property Callback JSBase
andJSObjectRef
- The callback invoked when deleting a property.
- JSObject
Finalize Callback JSBase
andJSObjectRef
- The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
- JSObject
GetProperty Callback JSBase
andJSObjectRef
- The callback invoked when getting a property’s value.
- JSObject
GetProperty Names Callback JSBase
andJSObjectRef
- The callback invoked when collecting the names of an object’s properties.
- JSObject
HasInstance Callback JSBase
andJSObjectRef
- hasInstance The callback invoked when an object is used as the target of an ‘instanceof’ expression.
- JSObject
HasProperty Callback JSBase
andJSObjectRef
- The callback invoked when determining whether an object has a property.
- JSObject
Initialize Callback JSBase
andJSObjectRef
- The callback invoked when an object is first created.
- JSObject
Ref JSBase
- Apple’s documentation
- JSObject
SetProperty Callback JSBase
andJSObjectRef
- 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 JSValue
andobjc2-foundation
- Apple’s documentation
- JSValue
Ref JSBase
- Apple’s documentation