Ultralight C++ API 1.3.0
Loading...
Searching...
No Matches
JSValueRef.h File Reference

Go to the source code of this file.

Functions

 ios (10.0))
 
JSType JSValueGetType (JSContextRef ctx, JSValueRef value)
 Returns a JavaScript value's type.
 
bool JSValueIsUndefined (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the undefined type.
 
bool JSValueIsNull (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the null type.
 
bool JSValueIsBoolean (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the boolean type.
 
bool JSValueIsNumber (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the number type.
 
bool JSValueIsString (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the string type.
 
bool JSValueIsSymbol (JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.15)
 Tests whether a JavaScript value's type is the symbol type.
 
bool ios (13.0))
 
bool JSValueIsObject (JSContextRef ctx, JSValueRef value)
 Tests whether a JavaScript value's type is the object type.
 
bool JSValueIsObjectOfClass (JSContextRef ctx, JSValueRef value, JSClassRef jsClass)
 Tests whether a JavaScript value is an object with a given class in its class chain.
 
bool JSValueIsArray (JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.11)
 Tests whether a JavaScript value is an array.
 
bool ios (9.0))
 
bool JSValueIsDate (JSContextRef ctx, JSValueRef value) JSC_API_AVAILABLE(macos(10.11)
 Tests whether a JavaScript value is a date.
 
JSTypedArrayType JSValueGetTypedArrayType (JSContextRef ctx, JSValueRef value, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.12)
 Returns a JavaScript value's Typed Array type.
 
bool JSValueIsEqual (JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef *exception)
 Tests whether two JavaScript values are equal, as compared by the JS == operator.
 
bool JSValueIsStrictEqual (JSContextRef ctx, JSValueRef a, JSValueRef b)
 Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
 
bool JSValueIsInstanceOfConstructor (JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef *exception)
 Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
 
JSValueRef JSValueMakeUndefined (JSContextRef ctx)
 Creates a JavaScript value of the undefined type.
 
JSValueRef JSValueMakeNull (JSContextRef ctx)
 Creates a JavaScript value of the null type.
 
JSValueRef JSValueMakeBoolean (JSContextRef ctx, bool boolean)
 Creates a JavaScript value of the boolean type.
 
JSValueRef JSValueMakeNumber (JSContextRef ctx, double number)
 Creates a JavaScript value of the number type.
 
JSValueRef JSValueMakeString (JSContextRef ctx, JSStringRef string)
 Creates a JavaScript value of the string type.
 
JSValueRef JSValueMakeSymbol (JSContextRef ctx, JSStringRef description) JSC_API_AVAILABLE(macos(10.15)
 Creates a JavaScript value of the symbol type.
 
JSValueRef JSValueMakeFromJSONString (JSContextRef ctx, JSStringRef string) JSC_API_AVAILABLE(macos(10.7)
 Creates a JavaScript value from a JSON formatted string.
 
JSValueRef ios (7.0))
 
JSStringRef JSValueCreateJSONString (JSContextRef ctx, JSValueRef value, unsigned indent, JSValueRef *exception) JSC_API_AVAILABLE(macos(10.7)
 Creates a JavaScript string containing the JSON serialized representation of a JS value.
 
bool JSValueToBoolean (JSContextRef ctx, JSValueRef value)
 Converts a JavaScript value to boolean and returns the resulting boolean.
 
double JSValueToNumber (JSContextRef ctx, JSValueRef value, JSValueRef *exception)
 Converts a JavaScript value to number and returns the resulting number.
 
JSStringRef JSValueToStringCopy (JSContextRef ctx, JSValueRef value, JSValueRef *exception)
 Converts a JavaScript value to string and copies the result into a JavaScript string.
 
JSObjectRef JSValueToObject (JSContextRef ctx, JSValueRef value, JSValueRef *exception)
 Converts a JavaScript value to object and returns the resulting object.
 
void JSValueProtect (JSContextRef ctx, JSValueRef value)
 Protects a JavaScript value from garbage collection.
 
void JSValueUnprotect (JSContextRef ctx, JSValueRef value)
 Unprotects a JavaScript value from garbage collection.
 

Enumerations

enum  JSType {
  kJSTypeUndefined , kJSTypeNull , kJSTypeBoolean , kJSTypeNumber ,
  kJSTypeString , kJSTypeObject , JSC_API_AVAILABLE =(macos(10.15), ios(13.0))
}
 A constant identifying the type of a JSValue. More...
 
enum  JSTypedArrayType {
  kJSTypedArrayTypeInt8Array , kJSTypedArrayTypeInt16Array , kJSTypedArrayTypeInt32Array , kJSTypedArrayTypeUint8Array ,
  kJSTypedArrayTypeUint8ClampedArray , kJSTypedArrayTypeUint16Array , kJSTypedArrayTypeUint32Array , kJSTypedArrayTypeFloat32Array ,
  kJSTypedArrayTypeFloat64Array , kJSTypedArrayTypeArrayBuffer , kJSTypedArrayTypeNone
}
 A constant identifying the Typed Array type of a JSObjectRef. More...
 

Function Documentation

◆ ios() [1/4]

ios ( 10.  0)

◆ ios() [2/4]

bool ios ( 13.  0)

◆ ios() [3/4]

JSValueRef ios ( 7.  0)

◆ ios() [4/4]

bool ios ( 9.  0)

◆ JSValueCreateJSONString()

JSStringRef JSValueCreateJSONString ( JSContextRef  ctx,
JSValueRef  value,
unsigned  indent,
JSValueRef exception 
)

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

◆ JSValueGetType()

JSType JSValueGetType ( JSContextRef  ctx,
JSValueRef  value 
)

Returns a JavaScript value's type.

◆ JSValueGetTypedArrayType()

JSTypedArrayType JSValueGetTypedArrayType ( JSContextRef  ctx,
JSValueRef  value,
JSValueRef exception 
)

Returns a JavaScript value's Typed Array type.

◆ JSValueIsArray()

bool JSValueIsArray ( JSContextRef  ctx,
JSValueRef  value 
)

Tests whether a JavaScript value is an array.

◆ JSValueIsBoolean()

bool JSValueIsBoolean ( JSContextRef  ctx,
JSValueRef  value 
)

Tests whether a JavaScript value's type is the boolean type.

◆ JSValueIsDate()

bool JSValueIsDate ( JSContextRef  ctx,
JSValueRef  value 
)

Tests whether a JavaScript value is a date.

◆ JSValueIsEqual()

bool JSValueIsEqual ( JSContextRef  ctx,
JSValueRef  a,
JSValueRef  b,
JSValueRef exception 
)

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

◆ JSValueIsInstanceOfConstructor()

bool JSValueIsInstanceOfConstructor ( JSContextRef  ctx,
JSValueRef  value,
JSObjectRef  constructor,
JSValueRef exception 
)

Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.

◆ JSValueIsNull()

bool JSValueIsNull ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueIsNumber()

bool JSValueIsNumber ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueIsObject()

bool JSValueIsObject ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueIsObjectOfClass()

bool JSValueIsObjectOfClass ( JSContextRef  ctx,
JSValueRef  value,
JSClassRef  jsClass 
)

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

◆ JSValueIsStrictEqual()

bool JSValueIsStrictEqual ( JSContextRef  ctx,
JSValueRef  a,
JSValueRef  b 
)

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

◆ JSValueIsString()

bool JSValueIsString ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueIsSymbol()

bool JSValueIsSymbol ( JSContextRef  ctx,
JSValueRef  value 
)

Tests whether a JavaScript value's type is the symbol type.

◆ JSValueIsUndefined()

bool JSValueIsUndefined ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueMakeBoolean()

JSValueRef JSValueMakeBoolean ( JSContextRef  ctx,
bool  boolean 
)

Creates a JavaScript value of the boolean type.

◆ JSValueMakeFromJSONString()

JSValueRef JSValueMakeFromJSONString ( JSContextRef  ctx,
JSStringRef  string 
)

Creates a JavaScript value from a JSON formatted string.

◆ JSValueMakeNull()

JSValueRef JSValueMakeNull ( JSContextRef  ctx)

Creates a JavaScript value of the null type.

◆ JSValueMakeNumber()

JSValueRef JSValueMakeNumber ( JSContextRef  ctx,
double  number 
)

Creates a JavaScript value of the number type.

◆ JSValueMakeString()

JSValueRef JSValueMakeString ( JSContextRef  ctx,
JSStringRef  string 
)

Creates a JavaScript value of the string type.

◆ JSValueMakeSymbol()

JSValueRef JSValueMakeSymbol ( JSContextRef  ctx,
JSStringRef  description 
)

Creates a JavaScript value of the symbol type.

◆ JSValueMakeUndefined()

JSValueRef JSValueMakeUndefined ( JSContextRef  ctx)

Creates a JavaScript value of the undefined type.

◆ JSValueProtect()

void JSValueProtect ( JSContextRef  ctx,
JSValueRef  value 
)

Protects a JavaScript value from garbage collection.

◆ JSValueToBoolean()

bool JSValueToBoolean ( JSContextRef  ctx,
JSValueRef  value 
)

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

◆ JSValueToNumber()

double JSValueToNumber ( JSContextRef  ctx,
JSValueRef  value,
JSValueRef exception 
)

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

◆ JSValueToObject()

JSObjectRef JSValueToObject ( JSContextRef  ctx,
JSValueRef  value,
JSValueRef exception 
)

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

◆ JSValueToStringCopy()

JSStringRef JSValueToStringCopy ( JSContextRef  ctx,
JSValueRef  value,
JSValueRef exception 
)

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

◆ JSValueUnprotect()

void JSValueUnprotect ( JSContextRef  ctx,
JSValueRef  value 
)

Unprotects a JavaScript value from garbage collection.

Enumeration Type Documentation

◆ JSType

enum JSType

A constant identifying the type of a JSValue.

  • kJSTypeUndefined The unique undefined value.
  • kJSTypeNull The unique null value.
  • kJSTypeBoolean A primitive boolean value, one of true or false.
  • kJSTypeNumber A primitive number value.
  • kJSTypeString A primitive string value.
  • kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef).
  • kJSTypeSymbol A primitive symbol value.
Enumerator
kJSTypeUndefined 
kJSTypeNull 
kJSTypeBoolean 
kJSTypeNumber 
kJSTypeString 
kJSTypeObject 
JSC_API_AVAILABLE 

◆ JSTypedArrayType

A constant identifying the Typed Array type of a JSObjectRef.

  • kJSTypedArrayTypeInt8Array Int8Array
  • kJSTypedArrayTypeInt16Array Int16Array
  • kJSTypedArrayTypeInt32Array Int32Array
  • kJSTypedArrayTypeUint8Array Uint8Array
  • kJSTypedArrayTypeUint8ClampedArray Uint8ClampedArray
  • kJSTypedArrayTypeUint16Array Uint16Array
  • kJSTypedArrayTypeUint32Array Uint32Array
  • kJSTypedArrayTypeFloat32Array Float32Array
  • kJSTypedArrayTypeFloat64Array Float64Array
  • kJSTypedArrayTypeArrayBuffer ArrayBuffer
  • kJSTypedArrayTypeNone Not a Typed Array
Enumerator
kJSTypedArrayTypeInt8Array 
kJSTypedArrayTypeInt16Array 
kJSTypedArrayTypeInt32Array 
kJSTypedArrayTypeUint8Array 
kJSTypedArrayTypeUint8ClampedArray 
kJSTypedArrayTypeUint16Array 
kJSTypedArrayTypeUint32Array 
kJSTypedArrayTypeFloat32Array 
kJSTypedArrayTypeFloat64Array 
kJSTypedArrayTypeArrayBuffer 
kJSTypedArrayTypeNone