|
Ultralight C++ API 2.0.0
|
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. | |
| bool | JSValueGetErrorDetails (JSContextRef ctx, JSValueRef value, JSTypedErrorType *outType, JSStringRef *outMessage, JSStringRef *outSourceURL, unsigned *outLine, unsigned *outColumn, JSStringRef *outStack) |
| Extracts the type, message, source location, and stack trace of an error value in one call. | |
| bool | JSValueIsFunctionObject (JSContextRef ctx, JSValueRef value) |
| Tests whether a JavaScript value is an actual function object. | |
Typedefs | |
| typedef enum JSTypedArrayType | ios |
| ios | ( | 10. | 0 | ) |
| bool ios | ( | 13. | 0 | ) |
| JSValueRef ios | ( | 7. | 0 | ) |
| bool ios | ( | 9. | 0 | ) |
| JSStringRef JSValueCreateJSONString | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| unsigned | indent, | ||
| JSValueRef * | exception ) |
Creates a JavaScript string containing the JSON serialized representation of a JS value.
| ctx | The execution context to use. |
| value | The value to serialize. |
| indent | The number of spaces to indent when nesting. If 0, the resulting JSON will not contains newlines. The size of the indent is clamped to 10 spaces. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| bool JSValueGetErrorDetails | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSTypedErrorType * | outType, | ||
| JSStringRef * | outMessage, | ||
| JSStringRef * | outSourceURL, | ||
| unsigned * | outLine, | ||
| unsigned * | outColumn, | ||
| JSStringRef * | outStack ) |
Extracts the type, message, source location, and stack trace of an error value in one call.
| ctx | The execution context to use. |
| value | The JSValue to inspect, typically an exception returned by another function. |
| outType | Receives the error's JSTypedErrorType. Error types with no dedicated constant report kJSTypedError_Error. May be NULL. |
| outMessage | Receives the error's message as a JSString, or NULL if it has none. May be NULL. |
| outSourceURL | Receives the URL of the script that created the error as a JSString, or NULL if unknown. May be NULL. |
| outLine | Receives the 1-based line number the error originated at, or 0 if unknown. May be NULL. |
| outColumn | Receives the 1-based column number the error originated at, or 0 if unknown. May be NULL. |
| outStack | Receives the error's stack trace as a JSString, or NULL if it has none. May be NULL. |
| JSType JSValueGetType | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Returns a JavaScript value's type.
| ctx | The execution context to use. |
| value | The JSValue whose type you want to obtain. |
| JSTypedArrayType JSValueGetTypedArrayType | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSValueRef * | exception ) |
Returns a JavaScript value's Typed Array type.
| ctx | The execution context to use. |
| value | The JSValue whose Typed Array type to return. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| bool JSValueIsArray | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value is an array.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsBoolean | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the boolean type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsDate | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value is a date.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsEqual | ( | JSContextRef | ctx, |
| JSValueRef | a, | ||
| JSValueRef | b, | ||
| JSValueRef * | exception ) |
Tests whether two JavaScript values are equal, as compared by the JS == operator.
| ctx | The execution context to use. |
| a | The first value to test. |
| b | The second value to test. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| bool JSValueIsFunctionObject | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value is an actual function object.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| 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.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| constructor | The constructor to test against. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| bool JSValueIsNull | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the null type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsNumber | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the number type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsObject | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the object type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsObjectOfClass | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSClassRef | jsClass ) |
Tests whether a JavaScript value is an object with a given class in its class chain.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| jsClass | The JSClass to test against. |
| bool JSValueIsStrictEqual | ( | JSContextRef | ctx, |
| JSValueRef | a, | ||
| JSValueRef | b ) |
Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
| ctx | The execution context to use. |
| a | The first value to test. |
| b | The second value to test. |
| bool JSValueIsString | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the string type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsSymbol | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the symbol type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| bool JSValueIsUndefined | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Tests whether a JavaScript value's type is the undefined type.
| ctx | The execution context to use. |
| value | The JSValue to test. |
| JSValueRef JSValueMakeBoolean | ( | JSContextRef | ctx, |
| bool | boolean ) |
Creates a JavaScript value of the boolean type.
| ctx | The execution context to use. |
| boolean | The bool to assign to the newly created JSValue. |
| JSValueRef JSValueMakeFromJSONString | ( | JSContextRef | ctx, |
| JSStringRef | string ) |
Creates a JavaScript value from a JSON formatted string.
| ctx | The execution context to use. |
| string | The JSString containing the JSON string to be parsed. |
| JSValueRef JSValueMakeNull | ( | JSContextRef | ctx | ) |
Creates a JavaScript value of the null type.
| ctx | The execution context to use. |
| JSValueRef JSValueMakeNumber | ( | JSContextRef | ctx, |
| double | number ) |
Creates a JavaScript value of the number type.
| ctx | The execution context to use. |
| number | The double to assign to the newly created JSValue. |
| JSValueRef JSValueMakeString | ( | JSContextRef | ctx, |
| JSStringRef | string ) |
Creates a JavaScript value of the string type.
| ctx | The execution context to use. |
| string | The JSString to assign to the newly created JSValue. The newly created JSValue retains string, and releases it upon garbage collection. |
| JSValueRef JSValueMakeSymbol | ( | JSContextRef | ctx, |
| JSStringRef | description ) |
Creates a JavaScript value of the symbol type.
| ctx | The execution context to use. |
| description | A description of the newly created symbol value. |
| JSValueRef JSValueMakeUndefined | ( | JSContextRef | ctx | ) |
Creates a JavaScript value of the undefined type.
| ctx | The execution context to use. |
| void JSValueProtect | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Protects a JavaScript value from garbage collection.
| ctx | The execution context to use. |
| value | The JSValue to protect. |
Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.
A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
| bool JSValueToBoolean | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Converts a JavaScript value to boolean and returns the resulting boolean.
| ctx | The execution context to use. |
| value | The JSValue to convert. |
| double JSValueToNumber | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSValueRef * | exception ) |
Converts a JavaScript value to number and returns the resulting number.
| ctx | The execution context to use. |
| value | The JSValue to convert. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| JSObjectRef JSValueToObject | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSValueRef * | exception ) |
Converts a JavaScript value to object and returns the resulting object.
| ctx | The execution context to use. |
| value | The JSValue to convert. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| JSStringRef JSValueToStringCopy | ( | JSContextRef | ctx, |
| JSValueRef | value, | ||
| JSValueRef * | exception ) |
Converts a JavaScript value to string and copies the result into a JavaScript string.
| ctx | The execution context to use. |
| value | The JSValue to convert. |
| exception | A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. |
| void JSValueUnprotect | ( | JSContextRef | ctx, |
| JSValueRef | value ) |
Unprotects a JavaScript value from garbage collection.
| ctx | The execution context to use. |
| value | The JSValue to unprotect. |
| 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. kJSTypeBigInt A primitive BigInt value. | Enumerator | |
|---|---|
| kJSTypeUndefined | |
| kJSTypeNull | |
| kJSTypeBoolean | |
| kJSTypeNumber | |
| kJSTypeString | |
| kJSTypeObject | |
| JSC_API_AVAILABLE | |
| JSC_API_AVAILABLE | |
| enum 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 kJSTypedArrayTypeBigInt64Array BigInt64Array kJSTypedArrayTypeBigUint64Array BigUint64Array kJSTypedArrayTypeArrayBuffer ArrayBuffer kJSTypedArrayTypeNone Not a Typed Array | enum JSTypedErrorType |
A constant identifying the type of a JavaScript error object.
kJSTypedError_Error A plain Error, or an error type with no dedicated constant. kJSTypedError_TypeError A TypeError. kJSTypedError_RangeError A RangeError. kJSTypedError_SyntaxError A SyntaxError. kJSTypedError_ReferenceError A ReferenceError. kJSTypedError_EvalError An EvalError. | Enumerator | |
|---|---|
| kJSTypedError_Error | |
| kJSTypedError_TypeError | |
| kJSTypedError_RangeError | |
| kJSTypedError_SyntaxError | |
| kJSTypedError_ReferenceError | |
| kJSTypedError_EvalError | |