Crate objc2_javascript_core

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 JSObjectRef and JSValueRef
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§

JSBigIntCreateWithDoubleJSBase and JSValueRef
Creates a JavaScript BigInt with a double.
JSBigIntCreateWithInt64JSBase and JSValueRef
Creates a JavaScript BigInt with a 64-bit signed integer.
JSBigIntCreateWithStringJSBase and JSValueRef
Creates a JavaScript BigInt with an integer represented in string.
JSBigIntCreateWithUInt64JSBase and JSValueRef
Creates a JavaScript BigInt with a 64-bit unsigned integer.
JSCheckScriptSyntaxJSBase
Checks for syntax errors in a string of JavaScript.
JSClassCreateJSBase and JSObjectRef and JSValueRef
Creates a JavaScript class suitable for use with JSObjectMake.
JSClassReleaseJSBase and JSObjectRef
Releases a JavaScript class.
JSClassRetainJSBase and JSObjectRef
Retains a JavaScript class.
JSContextGetGlobalContextDeprecatedJSBase and JSContextRef
JSContextGetGlobalObjectDeprecatedJSBase and JSContextRef
JSContextGetGroupDeprecatedJSBase and JSContextRef
JSContextGroupCreateDeprecatedJSBase and JSContextRef
JSContextGroupReleaseDeprecatedJSBase and JSContextRef
JSContextGroupRetainDeprecatedJSBase and JSContextRef
JSEvaluateScriptJSBase
Evaluates a string of JavaScript.
JSGarbageCollectJSBase
Performs a JavaScript garbage collection.
JSGlobalContextCopyNameJSBase and JSContextRef
Gets a copy of the name of a context.
JSGlobalContextCreateJSBase and JSContextRef
Creates a global JavaScript execution context.
JSGlobalContextCreateInGroupJSBase and JSContextRef
Creates a global JavaScript execution context in the context group provided.
JSGlobalContextIsInspectableJSBase and JSContextRef
Gets whether the context is inspectable in Web Inspector.
JSGlobalContextReleaseJSBase and JSContextRef
Releases a global JavaScript execution context.
JSGlobalContextRetainJSBase and JSContextRef
Retains a global JavaScript execution context.
JSGlobalContextSetInspectableJSBase and JSContextRef
Sets whether the context is inspectable in Web Inspector. Default value is NO.
JSGlobalContextSetNameJSBase and JSContextRef
Sets the name exposed when inspecting a context.
JSObjectCallAsConstructorJSBase and JSObjectRef
Calls an object as a constructor.
JSObjectCallAsFunctionJSBase and JSObjectRef
Calls an object as a function.
JSObjectCopyPropertyNamesJSBase and JSObjectRef
Gets the names of an object’s enumerable properties.
JSObjectDeletePropertyJSBase and JSObjectRef
Deletes a property from an object.
JSObjectDeletePropertyForKeyJSBase and JSObjectRef
Deletes a property from an object using a JSValueRef as the property key.
JSObjectGetArrayBufferByteLengthJSBase and JSTypedArray
Returns the number of bytes in a JavaScript data object.
JSObjectGetArrayBufferBytesPtrJSBase and JSTypedArray
Returns a pointer to the data buffer that serves as the backing store for a JavaScript Typed Array object.
JSObjectGetPrivateJSBase and JSObjectRef
Gets an object’s private data.
JSObjectGetPropertyJSBase and JSObjectRef
Gets a property from an object.
JSObjectGetPropertyAtIndexJSBase and JSObjectRef
Gets a property from an object by numeric index.
JSObjectGetPropertyForKeyJSBase and JSObjectRef
Gets a property from an object using a JSValueRef as the property key.
JSObjectGetPrototypeJSBase and JSObjectRef
Gets an object’s prototype.
JSObjectGetTypedArrayBufferJSBase and JSTypedArray
Returns the JavaScript Array Buffer object that is used as the backing of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteLengthJSBase and JSTypedArray
Returns the byte length of a JavaScript Typed Array object.
JSObjectGetTypedArrayByteOffsetJSBase and JSTypedArray
Returns the byte offset of a JavaScript Typed Array object.
JSObjectGetTypedArrayBytesPtrJSBase and JSTypedArray
Returns a temporary pointer to the backing store of a JavaScript Typed Array object.
JSObjectGetTypedArrayLengthJSBase and JSTypedArray
Returns the length of a JavaScript Typed Array object.
JSObjectHasPropertyJSBase and JSObjectRef
Tests whether an object has a given property.
JSObjectHasPropertyForKeyJSBase and JSObjectRef
Tests whether an object has a given property using a JSValueRef as the property key.
JSObjectIsConstructorJSBase and JSObjectRef
Tests whether an object can be called as a constructor.
JSObjectIsFunctionJSBase and JSObjectRef
Tests whether an object can be called as a function.
JSObjectMakeJSBase and JSObjectRef
Creates a JavaScript object.
JSObjectMakeArrayJSBase and JSObjectRef
Creates a JavaScript Array object.
JSObjectMakeArrayBufferWithBytesNoCopyJSBase and JSTypedArray
Creates a JavaScript Array Buffer object from an existing pointer.
JSObjectMakeConstructorJSBase and JSObjectRef
Convenience method for creating a JavaScript constructor.
JSObjectMakeDateJSBase and JSObjectRef
Creates a JavaScript Date object, as if by invoking the built-in Date constructor.
JSObjectMakeDeferredPromiseJSBase and JSObjectRef
Creates a JavaScript promise object by invoking the provided executor.
JSObjectMakeErrorJSBase and JSObjectRef
Creates a JavaScript Error object, as if by invoking the built-in Error constructor.
JSObjectMakeFunctionJSBase and JSObjectRef
Creates a function with a given script as its body.
JSObjectMakeFunctionWithCallbackJSBase and JSObjectRef
Convenience method for creating a JavaScript function with a given callback as its implementation.
JSObjectMakeRegExpJSBase and JSObjectRef
Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.
JSObjectMakeTypedArrayJSBase and JSTypedArray and JSValueRef
Creates a JavaScript Typed Array object with the given number of elements.
JSObjectMakeTypedArrayWithArrayBufferJSBase and JSTypedArray and JSValueRef
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object.
JSObjectMakeTypedArrayWithArrayBufferAndOffsetJSBase and JSTypedArray and JSValueRef
Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length.
JSObjectMakeTypedArrayWithBytesNoCopyJSBase and JSTypedArray and JSValueRef
Creates a JavaScript Typed Array object from an existing pointer.
JSObjectSetPrivateJSBase and JSObjectRef
Sets a pointer to private data on an object.
JSObjectSetPropertyJSBase and JSObjectRef
Sets a property on an object.
JSObjectSetPropertyAtIndexJSBase and JSObjectRef
Sets a property on an object by numeric index.
JSObjectSetPropertyForKeyJSBase and JSObjectRef
Sets a property on an object using a JSValueRef as the property key.
JSObjectSetPrototypeJSBase and JSObjectRef
Sets an object’s prototype.
JSPropertyNameAccumulatorAddNameJSBase and JSObjectRef
Adds a property name to a JavaScript property name accumulator.
JSPropertyNameArrayGetCountJSBase and JSObjectRef
Gets a count of the number of items in a JavaScript property name array.
JSPropertyNameArrayGetNameAtIndexJSBase and JSObjectRef
Gets a property name at a given index in a JavaScript property name array.
JSPropertyNameArrayReleaseJSBase and JSObjectRef
Releases a JavaScript property name array.
JSPropertyNameArrayRetainJSBase and JSObjectRef
Retains a JavaScript property name array.
JSStringCopyCFStringJSBase and JSStringRefCF and objc2-core-foundation
Creates a CFString from a JavaScript string.
JSStringCreateWithCFStringJSBase and JSStringRefCF and objc2-core-foundation
Creates a JavaScript string from a CFString.
JSStringCreateWithCharactersJSBase and JSStringRef
Creates a JavaScript string from a buffer of Unicode characters.
JSStringCreateWithUTF8CStringJSBase and JSStringRef
Creates a JavaScript string from a null-terminated UTF8 string.
JSStringGetCharactersPtrJSBase and JSStringRef
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
JSStringGetLengthJSBase and JSStringRef
Returns the number of Unicode characters in a JavaScript string.
JSStringGetMaximumUTF8CStringSizeJSBase and JSStringRef
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
JSStringGetUTF8CStringJSBase and JSStringRef
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
JSStringIsEqualJSBase and JSStringRef
Tests whether two JavaScript strings match.
JSStringIsEqualToUTF8CStringJSBase and JSStringRef
Tests whether a JavaScript string matches a null-terminated UTF8 string.
JSStringReleaseJSBase and JSStringRef
Releases a JavaScript string.
JSStringRetainJSBase and JSStringRef
Retains a JavaScript string.
JSValueCompareDeprecatedJSBase and JSValueRef
JSValueCompareDoubleDeprecatedJSBase and JSValueRef
JSValueCompareInt64DeprecatedJSBase and JSValueRef
JSValueCompareUInt64DeprecatedJSBase and JSValueRef
JSValueCreateJSONStringDeprecatedJSBase and JSValueRef
JSValueGetTypeDeprecatedJSBase and JSValueRef
JSValueGetTypedArrayTypeDeprecatedJSBase and JSValueRef
JSValueIsArrayDeprecatedJSBase and JSValueRef
JSValueIsBigIntDeprecatedJSBase and JSValueRef
JSValueIsBooleanDeprecatedJSBase and JSValueRef
JSValueIsDateDeprecatedJSBase and JSValueRef
JSValueIsEqualDeprecatedJSBase and JSValueRef
JSValueIsInstanceOfConstructorDeprecatedJSBase and JSValueRef
JSValueIsNullDeprecatedJSBase and JSValueRef
JSValueIsNumberDeprecatedJSBase and JSValueRef
JSValueIsObjectDeprecatedJSBase and JSValueRef
JSValueIsObjectOfClassDeprecatedJSBase and JSValueRef
JSValueIsStrictEqualDeprecatedJSBase and JSValueRef
JSValueIsStringDeprecatedJSBase and JSValueRef
JSValueIsSymbolDeprecatedJSBase and JSValueRef
JSValueIsUndefinedDeprecatedJSBase and JSValueRef
JSValueMakeBooleanDeprecatedJSBase and JSValueRef
JSValueMakeFromJSONStringDeprecatedJSBase and JSValueRef
JSValueMakeNullDeprecatedJSBase and JSValueRef
JSValueMakeNumberDeprecatedJSBase and JSValueRef
JSValueMakeStringDeprecatedJSBase and JSValueRef
JSValueMakeSymbolDeprecatedJSBase and JSValueRef
JSValueMakeUndefinedDeprecatedJSBase and JSValueRef
JSValueProtectDeprecatedJSBase and JSValueRef
JSValueToBooleanDeprecatedJSBase and JSValueRef
JSValueToInt32DeprecatedJSBase and JSValueRef
JSValueToInt64DeprecatedJSBase and JSValueRef
JSValueToNumberDeprecatedJSBase and JSValueRef
JSValueToObjectDeprecatedJSBase and JSValueRef
JSValueToStringCopyDeprecatedJSBase and JSValueRef
JSValueToUInt32DeprecatedJSBase and JSValueRef
JSValueToUInt64DeprecatedJSBase and JSValueRef
JSValueUnprotectDeprecatedJSBase and JSValueRef

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