JSValueRef.h

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

Topics

Functions

func JSValueCreateJSONString(JSContextRef!, JSValueRef!, UInt32, UnsafeMutablePointer<JSValueRef?>!) -> JSStringRef!

Creates a JavaScript string containing the JSON serialized representation of a JavaScript value.

func JSValueIsBoolean(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value is Boolean.

func JSValueIsEqual(JSContextRef!, JSValueRef!, JSValueRef!, UnsafeMutablePointer<JSValueRef?>!) -> Bool

Tests whether two JavaScript values are equal, as compared by the JS == operator.

func JSValueIsInstanceOfConstructor(JSContextRef!, JSValueRef!, JSObjectRef!, UnsafeMutablePointer<JSValueRef?>!) -> Bool

Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the isInstance(of:) operator.

func JSValueIsNull(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value’s type is the null type.

func JSValueIsNumber(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value’s type is the number type.

func JSValueIsObject(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value’s type is the object type.

func JSValueIsObjectOfClass(JSContextRef!, JSValueRef!, JSClassRef!) -> Bool

Tests whether a JavaScript value is an object with a given class in its class chain.

func JSValueIsStrictEqual(JSContextRef!, JSValueRef!, JSValueRef!) -> Bool

Tests whether two JavaScript values are strict equal, as compared by the JS === operator.

func JSValueIsString(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value’s type is the string type.

func JSValueIsUndefined(JSContextRef!, JSValueRef!) -> Bool

Tests whether a JavaScript value’s type is the undefined type.

func JSValueMakeFromJSONString(JSContextRef!, JSStringRef!) -> JSValueRef!

Creates a JavaScript value from a JSON formatted string.

func JSValueMakeNull(JSContextRef!) -> JSValueRef!

Creates a JavaScript value of the null type.

func JSValueMakeNumber(JSContextRef!, Double) -> JSValueRef!

Creates a JavaScript value of the number type.

func JSValueMakeString(JSContextRef!, JSStringRef!) -> JSValueRef!

Creates a JavaScript value of the string type.

func JSValueMakeUndefined(JSContextRef!) -> JSValueRef!

Creates a JavaScript value of the undefined type.

func JSValueProtect(JSContextRef!, JSValueRef!)

Protects a JavaScript value from garbage collection.

func JSValueToBoolean(JSContextRef!, JSValueRef!) -> Bool

Converts a JavaScript value to a Boolean and returns the resulting Boolean.

func JSValueToNumber(JSContextRef!, JSValueRef!, UnsafeMutablePointer<JSValueRef?>!) -> Double

Converts a JavaScript value to number and returns the resulting number.

func JSValueToObject(JSContextRef!, JSValueRef!, UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!

Converts a JavaScript value to object and returns the resulting object.

func JSValueToStringCopy(JSContextRef!, JSValueRef!, UnsafeMutablePointer<JSValueRef?>!) -> JSStringRef!

Converts a JavaScript value to string and copies the result into a JavaScript string.

func JSValueUnprotect(JSContextRef!, JSValueRef!)

Unprotects a JavaScript value from garbage collection.

Data Types

struct JSType

A constant identifying the type of a JSValue.

See Also

Legacy JavaScriptCore APIs

JSBase.h

Defines the JavaScriptCore interface engine.

JSObjectRef.h

A JavaScript Object.

JSStringRef.h

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

JSStringRefCF.h

Contains CFString convenience methods.