JSObjectRef.h

A JavaScript Object.

Topics

Functions

func JSClassCreate(UnsafePointer<JSClassDefinition>!) -> JSClassRef!

Creates a JavaScript class suitable for use with JSObjectMake.

func JSClassRelease(JSClassRef!)

Releases a JavaScript class.

func JSObjectIsConstructor(JSContextRef!, JSObjectRef!) -> Bool

Tests whether an object can be called as a constructor.

func JSObjectIsFunction(JSContextRef!, JSObjectRef!) -> Bool

Tests whether an object can be called as a function.

func JSObjectMakeDate(JSContextRef!, Int, UnsafePointer<JSValueRef?>!, UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!

Creates a JavaScript Date object, as if by invoking the built-in Date constructor.

func JSObjectMakeError(JSContextRef!, Int, UnsafePointer<JSValueRef?>!, UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!

Creates a JavaScript Error object, as if by invoking the built-in Error constructor.

func JSObjectMakeFunctionWithCallback(JSContextRef!, JSStringRef!, JSObjectCallAsFunctionCallback!) -> JSObjectRef!

Convenience method for creating a JavaScript function with a given callback as its implementation.

func JSObjectMakeRegExp(JSContextRef!, Int, UnsafePointer<JSValueRef?>!, UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!

Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor.

func JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef!, JSStringRef!)

Adds a property name to a JavaScript property name accumulator.

func JSPropertyNameArrayGetCount(JSPropertyNameArrayRef!) -> Int

Gets a count of the number of items in a JavaScript property name array.

func JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef!, Int) -> JSStringRef!

Gets a property name at a given index in a JavaScript property name array.

func JSPropertyNameArrayRelease(JSPropertyNameArrayRef!)

Releases a JavaScript property name array.

Callbacks

See the Overview section above for header-level documentation.

typealias JSObjectCallAsConstructorCallback

The callback invoked when an object is used as a constructor in a 'new' expression.

typealias JSObjectCallAsFunctionCallback

The callback invoked when an object is called as a function.

typealias JSObjectConvertToTypeCallback

The callback invoked when converting an object to a particular JavaScript type.

typealias JSObjectDeletePropertyCallback

The callback invoked when deleting a property.

typealias JSObjectFinalizeCallback

The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread.

typealias JSObjectGetPropertyCallback

The callback invoked when getting a property’s value.

typealias JSObjectGetPropertyNamesCallback

The callback invoked when collecting the names of an object’s properties.

typealias JSObjectHasInstanceCallback

hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression.

typealias JSObjectHasPropertyCallback

The callback invoked when determining whether an object has a property.

typealias JSObjectInitializeCallback

The callback invoked when an object is first created.

typealias JSObjectSetPropertyCallback

The callback invoked when setting a property’s value.

Data Types

See the Overview section above for header-level documentation.

typealias JSClassAttributes

A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.

struct JSClassDefinition

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.

typealias JSPropertyAttributes

A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.

struct JSStaticFunction

This structure describes a statically declared function property.

struct JSStaticValue

This structure describes a statically declared value property.

Constants

See the Overview section above for header-level documentation.

See Also

Legacy JavaScriptCore APIs

JSBase.h

Defines the JavaScriptCore interface engine.

JSStringRef.h

A UTF16 character buffer that is the fundamental string representation in JavaScript.

JSStringRefCF.h

Contains CFString convenience methods.

JSValueRef.h

A JavaScript value that is the base type for all JavaScript values and the polymorphic functions on them.