Crate objc2_javascript_core

Source
Expand description

§Bindings to the JavaScriptCore framework

See Apple’s docs and the general docs on framework crates for more information.

Structs§

JSClassDefinitionJSBase and JSObjectRef and JSValueRef
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.
JSContextJSContext and objc2
A JSContext is a JavaScript execution environment. All JavaScript execution takes place within a context, and all JavaScript values are tied to a context.
JSManagedValueJSManagedValue and objc2
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.
JSRelationConditionJSValueRef
A constant identifying the type of JavaScript relation condition.
JSStaticFunctionJSBase and JSObjectRef
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.
JSStaticValueJSBase and JSObjectRef
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.
JSTypeJSValueRef
A constant identifying the type of a JSValue.
JSTypedArrayTypeJSValueRef
A constant identifying the Typed Array type of a JSObjectRef.
JSValueJSValue and objc2
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.
JSVirtualMachineJSVirtualMachine and objc2
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.
OpaqueJSClassJSBase
Apple’s documentation
OpaqueJSContextJSBase
Apple’s documentation
OpaqueJSContextGroupJSBase
Apple’s documentation
OpaqueJSPropertyNameAccumulatorJSBase
Apple’s documentation
OpaqueJSPropertyNameArrayJSBase
Apple’s documentation
OpaqueJSStringJSBase
Apple’s documentation
OpaqueJSValueJSBase
Apple’s documentation

Constants§

kJSClassAttributeNoAutomaticPrototypeJSObjectRef
Apple’s documentation
kJSClassAttributeNoneJSObjectRef
Apple’s documentation
kJSPropertyAttributeDontDeleteJSObjectRef
Apple’s documentation
kJSPropertyAttributeDontEnumJSObjectRef
Apple’s documentation
kJSPropertyAttributeNoneJSObjectRef
Apple’s documentation
kJSPropertyAttributeReadOnlyJSObjectRef
Apple’s documentation

Statics§

JSPropertyDescriptorConfigurableKeyJSValue and objc2-foundation
Apple’s documentation
JSPropertyDescriptorEnumerableKeyJSValue and objc2-foundation
Apple’s documentation
JSPropertyDescriptorGetKeyJSValue and objc2-foundation
Apple’s documentation
JSPropertyDescriptorSetKeyJSValue and objc2-foundation
Apple’s documentation
JSPropertyDescriptorValueKeyJSValue and objc2-foundation
Apple’s documentation
JSPropertyDescriptorWritableKeyJSValue and objc2-foundation
Property Descriptor Constants
kJSClassDefinitionEmptyJSBase and JSValueRef and JSObjectRef
A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes.

Traits§

JSExportJSExport and objc2
JSExport provides a declarative way to export Objective-C objects and classes – including properties, instance methods, class methods, and initializers – to JavaScript.

Functions§

JSBigIntCreateWithDoubleJSValueRef and JSBase
Creates a JavaScript BigInt with a double.
JSBigIntCreateWithInt64JSValueRef and JSBase
Creates a JavaScript BigInt with a 64-bit signed integer.
JSBigIntCreateWithStringJSValueRef and JSBase
Creates a JavaScript BigInt with an integer represented in string.
JSBigIntCreateWithUInt64JSValueRef and JSBase
Creates a JavaScript BigInt with a 64-bit unsigned integer.
JSCheckScriptSyntaxJSBase
Checks for syntax errors in a string of JavaScript.
JSClassCreateJSBase and JSValueRef and JSObjectRef
Creates a JavaScript class suitable for use with JSObjectMake.
JSClassReleaseJSObjectRef and JSBase
Releases a JavaScript class.
JSClassRetainJSObjectRef and JSBase
Retains a JavaScript class.
JSContextGetGlobalContextDeprecatedJSContextRef and JSBase
JSContextGetGlobalObjectDeprecatedJSContextRef and JSBase
JSContextGetGroupDeprecatedJSContextRef and JSBase
JSContextGroupCreateDeprecatedJSContextRef and JSBase
JSContextGroupReleaseDeprecatedJSContextRef and JSBase
JSContextGroupRetainDeprecatedJSContextRef and JSBase
JSEvaluateScriptJSBase
Evaluates a string of JavaScript.
JSGarbageCollectJSBase
Performs a JavaScript garbage collection.
JSGlobalContextCopyNameJSContextRef and JSBase
Gets a copy of the name of a context.
JSGlobalContextCreateJSContextRef and JSBase
Creates a global JavaScript execution context.
JSGlobalContextCreateInGroupJSContextRef and JSBase
Creates a global JavaScript execution context in the context group provided.
JSGlobalContextIsInspectableJSContextRef and JSBase
Gets whether the context is inspectable in Web Inspector.
JSGlobalContextReleaseJSContextRef and JSBase
Releases a global JavaScript execution context.
JSGlobalContextRetainJSContextRef and JSBase
Retains a global JavaScript execution context.
JSGlobalContextSetInspectableJSContextRef and JSBase
Sets whether the context is inspectable in Web Inspector. Default value is NO.
JSGlobalContextSetNameJSContextRef and JSBase
Sets the name exposed when inspecting a context.
JSObjectCallAsConstructorJSObjectRef and JSBase
Calls an object as a constructor.
JSObjectCallAsFunctionJSObjectRef and JSBase
Calls an object as a function.
JSObjectCopyPropertyNamesJSObjectRef and JSBase
Gets the names of an object’s enumerable properties.
JSObjectDeletePropertyJSObjectRef and JSBase
Deletes a property from an object.
JSObjectDeletePropertyForKeyJSObjectRef and JSBase
Deletes a property from an object using a JSValueRef as the property key.
JSObjectGetArrayBufferByteLengthJSTypedArray and JSBase
Returns the number of bytes in a JavaScript data object.
JSObjectGetArrayBufferBytesPtrJSTypedArray and JSBase
Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
JSObjectGetPrivateJSObjectRef and JSBase
Gets an object’s private data.
JSObjectGetPropertyJSObjectRef and JSBase
Gets a property from an object.
JSObjectGetPropertyAtIndexJSObjectRef and JSBase
Gets a property from an object by numeric index.
JSObjectGetPropertyForKeyJSObjectRef and JSBase
Gets a property from an object using a JSValueRef as the property key.
JSObjectGetPrototypeJSObjectRef and JSBase
Gets an object’s prototype.
JSObjectGetTypedArrayBufferJSTypedArray and JSBase
Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteLengthJSTypedArray and JSBase
Returns the byte length of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteOffsetJSTypedArray and JSBase
Returns the byte offset of a JavaScript Typed Array object.
JSObjectGetTypedArrayBytesPtrJSTypedArray and JSBase
Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
JSObjectGetTypedArrayLengthJSTypedArray and JSBase
Returns the length of a JavaScript Typed Array object.
JSObjectHasPropertyJSObjectRef and JSBase
Tests whether an object has a given property.
JSObjectHasPropertyForKeyJSObjectRef and JSBase
Tests whether an object has a given property using a JSValueRef as the property key.
JSObjectIsConstructorJSObjectRef and JSBase
Tests whether an object can be called as a constructor.
JSObjectIsFunctionJSObjectRef and JSBase
Tests whether an object can be called as a function.
JSObjectMakeJSObjectRef and JSBase
Creates a JavaScript object.
JSObjectMakeArrayJSObjectRef and JSBase
Creates a JavaScript Array object.
JSObjectMakeArrayBufferWithBytesNoCopyJSTypedArray and JSBase
Creates a JavaScript Array Buffer object from an existing pointer.
JSObjectMakeConstructorJSObjectRef and JSBase
Convenience method for creating a JavaScript constructor.
JSObjectMakeDateJSObjectRef and JSBase
Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
JSObjectMakeDeferredPromiseJSObjectRef and JSBase
Creates a JavaScript promise object by invoking the provided executor.
JSObjectMakeErrorJSObjectRef and JSBase
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
JSObjectMakeFunctionJSObjectRef and JSBase
Creates a function with a given script as its body.
JSObjectMakeFunctionWithCallbackJSObjectRef and JSBase
Convenience method for creating a JavaScript function with a given callback as its implementation.
JSObjectMakeRegExpJSObjectRef and JSBase
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
JSObjectMakeTypedArrayJSBase and JSValueRef and JSTypedArray
Creates a JavaScript Typed Array object with the given number of elements.
JSObjectMakeTypedArrayWithArrayBufferJSBase and JSValueRef and JSTypedArray
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
JSObjectMakeTypedArrayWithArrayBufferAndOffsetJSBase and JSValueRef and JSTypedArray
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.
JSObjectMakeTypedArrayWithBytesNoCopyJSBase and JSValueRef and JSTypedArray
Creates a JavaScript Typed Array object from an existing pointer.
JSObjectSetPrivateJSObjectRef and JSBase
Sets a pointer to private data on an object.
JSObjectSetPropertyJSObjectRef and JSBase
Sets a property on an object.
JSObjectSetPropertyAtIndexJSObjectRef and JSBase
Sets a property on an object by numeric index.
JSObjectSetPropertyForKeyJSObjectRef and JSBase
Sets a property on an object using a JSValueRef as the property key.
JSObjectSetPrototypeJSObjectRef and JSBase
Sets an object’s prototype.
JSPropertyNameAccumulatorAddNameJSObjectRef and JSBase
Adds a property name to a JavaScript property name accumulator.
JSPropertyNameArrayGetCountJSObjectRef and JSBase
Gets a count of the number of items in a JavaScript property name array.
JSPropertyNameArrayGetNameAtIndexJSObjectRef and JSBase
Gets a property name at a given index in a JavaScript property name array.
JSPropertyNameArrayReleaseJSObjectRef and JSBase
Releases a JavaScript property name array.
JSPropertyNameArrayRetainJSObjectRef and JSBase
Retains a JavaScript property name array.
JSStringCopyCFStringJSBase and JSStringRefCF and objc2-core-foundation
Creates a CFString from a JavaScript string.
JSStringCreateWithCFStringJSBase and objc2-core-foundation and JSStringRefCF
Creates a JavaScript string from a CFString.
JSStringCreateWithCharactersJSStringRef and JSBase
Creates a JavaScript string from a buffer of Unicode characters.
JSStringCreateWithUTF8CStringJSStringRef and JSBase
Creates a JavaScript string from a null-terminated UTF8 string.
JSStringGetCharactersPtrJSStringRef and JSBase
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
JSStringGetLengthJSStringRef and JSBase
Returns the number of Unicode characters in a JavaScript string.
JSStringGetMaximumUTF8CStringSizeJSStringRef and JSBase
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
JSStringGetUTF8CStringJSStringRef and JSBase
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
JSStringIsEqualJSStringRef and JSBase
Tests whether two JavaScript strings match.
JSStringIsEqualToUTF8CStringJSStringRef and JSBase
Tests whether a JavaScript string matches a null-terminated UTF8 string.
JSStringReleaseJSStringRef and JSBase
Releases a JavaScript string.
JSStringRetainJSStringRef and JSBase
Retains a JavaScript string.
JSValueCompareDeprecatedJSValueRef and JSBase
JSValueCompareDoubleDeprecatedJSValueRef and JSBase
JSValueCompareInt64DeprecatedJSValueRef and JSBase
JSValueCompareUInt64DeprecatedJSValueRef and JSBase
JSValueCreateJSONStringDeprecatedJSValueRef and JSBase
JSValueGetTypeDeprecatedJSValueRef and JSBase
JSValueGetTypedArrayTypeDeprecatedJSValueRef and JSBase
JSValueIsArrayDeprecatedJSValueRef and JSBase
JSValueIsBigIntDeprecatedJSValueRef and JSBase
JSValueIsBooleanDeprecatedJSValueRef and JSBase
JSValueIsDateDeprecatedJSValueRef and JSBase
JSValueIsEqualDeprecatedJSValueRef and JSBase
JSValueIsInstanceOfConstructorDeprecatedJSValueRef and JSBase
JSValueIsNullDeprecatedJSValueRef and JSBase
JSValueIsNumberDeprecatedJSValueRef and JSBase
JSValueIsObjectDeprecatedJSValueRef and JSBase
JSValueIsObjectOfClassDeprecatedJSValueRef and JSBase
JSValueIsStrictEqualDeprecatedJSValueRef and JSBase
JSValueIsStringDeprecatedJSValueRef and JSBase
JSValueIsSymbolDeprecatedJSValueRef and JSBase
JSValueIsUndefinedDeprecatedJSValueRef and JSBase
JSValueMakeBooleanDeprecatedJSValueRef and JSBase
JSValueMakeFromJSONStringDeprecatedJSValueRef and JSBase
JSValueMakeNullDeprecatedJSValueRef and JSBase
JSValueMakeNumberDeprecatedJSValueRef and JSBase
JSValueMakeStringDeprecatedJSValueRef and JSBase
JSValueMakeSymbolDeprecatedJSValueRef and JSBase
JSValueMakeUndefinedDeprecatedJSValueRef and JSBase
JSValueProtectDeprecatedJSValueRef and JSBase
JSValueToBooleanDeprecatedJSValueRef and JSBase
JSValueToInt32DeprecatedJSValueRef and JSBase
JSValueToInt64DeprecatedJSValueRef and JSBase
JSValueToNumberDeprecatedJSValueRef and JSBase
JSValueToObjectDeprecatedJSValueRef and JSBase
JSValueToStringCopyDeprecatedJSValueRef and JSBase
JSValueToUInt32DeprecatedJSValueRef and JSBase
JSValueToUInt64DeprecatedJSValueRef and JSBase
JSValueUnprotectDeprecatedJSValueRef and JSBase

Type Aliases§

JSCharJSStringRef
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.
JSClassAttributesJSObjectRef
A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.
JSClassRefJSBase
Apple’s documentation
JSContextGroupRefJSBase
Apple’s documentation
JSContextRefJSBase
Apple’s documentation
JSGlobalContextRefJSBase
Apple’s documentation
JSObjectCallAsConstructorCallbackJSBase and JSObjectRef
The callback invoked when an object is used as a constructor in a ‘new’ expression.
JSObjectCallAsFunctionCallbackJSBase and JSObjectRef
The callback invoked when an object is called as a function.
JSObjectConvertToTypeCallbackJSBase and JSObjectRef and JSValueRef
The callback invoked when converting an object to a particular JavaScript type.
JSObjectDeletePropertyCallbackJSBase and JSObjectRef
The callback invoked when deleting a property.
JSObjectFinalizeCallbackJSBase and JSObjectRef
The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.
JSObjectGetPropertyCallbackJSBase and JSObjectRef
The callback invoked when getting a property’s value.
JSObjectGetPropertyNamesCallbackJSBase and JSObjectRef
The callback invoked when collecting the names of an object’s properties.
JSObjectHasInstanceCallbackJSBase and JSObjectRef
hasInstance The callback invoked when an object is used as the target of an ‘instanceof’ expression.
JSObjectHasPropertyCallbackJSBase and JSObjectRef
The callback invoked when determining whether an object has a property.
JSObjectInitializeCallbackJSBase and JSObjectRef
The callback invoked when an object is first created.
JSObjectRefJSBase
Apple’s documentation
JSObjectSetPropertyCallbackJSBase and JSObjectRef
The callback invoked when setting a property’s value.
JSPropertyAttributesJSObjectRef
A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
JSPropertyNameAccumulatorRefJSBase
Apple’s documentation
JSPropertyNameArrayRefJSBase
Apple’s documentation
JSStringRefJSBase
Apple’s documentation
JSTypedArrayBytesDeallocatorJSBase
Apple’s documentation
JSValuePropertyJSValue and objc2-foundation
Apple’s documentation
JSValueRefJSBase
Apple’s documentation