js_value_ref library

Classes

JSType
enum JSType A constant identifying the type of a JSValue.
JSTypedArrayType
enum JSTypedArrayType A constant identifying the Typed Array type of a JSObjectRef.

Properties

jSValueCreateJSONString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, int indent, Pointer<NativeType> exception)
Creates a JavaScript string containing the JSON serialized representation of a JS value. ctx (JSContextRef) The execution context to use. value (JSValueRef) The value to serialize. indent (unsigned) 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 (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSStringRef) A JSString with the result of serialization, or NULL if an exception is thrown.
final
jSValueGetType int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Returns a JavaScript value's type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue whose type you want to obtain. @result (JSType) A value of type JSType that identifies value's type.
final
jSValueGetTypedArrayType int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Returns a JavaScript value's Typed Array type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue whose Typed Array type to return. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSTypedArrayType) A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object.
final
jSValueIsArray int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value is an array. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value is an array, otherwise false.
final
jSValueIsBoolean int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the boolean type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the boolean type, otherwise false.
final
jSValueIsDate int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value is a date. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value is a date, otherwise false.
final
jSValueIsEqual int Function(Pointer<NativeType> ctx, Pointer<NativeType> a, Pointer<NativeType> b, Pointer<NativeType> exception)
Tests whether two JavaScript values are equal, as compared by the JS == operator. ctx (JSContextRef) The execution context to use. a (JSValueRef) The first value to test. b (JSValueRef) The second value to test. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if the two values are equal, false if they are not equal or an exception is thrown.
final
jSValueIsInstanceOfConstructor int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> constructor, Pointer<NativeType> exception)
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. constructor (JSObjectRef) The constructor to test against. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (bool) true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
final
jSValueIsNull int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the null type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the null type, otherwise false.
final
jSValueIsNumber int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the number type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the number type, otherwise false.
final
jSValueIsObject int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the object type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the object type, otherwise false.
final
jSValueIsObjectOfClass int Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> jsClass)
Tests whether a JavaScript value is an object with a given class in its class chain. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. jsClass (JSClassRef) The JSClass to test against. @result (bool) true if value is an object and has jsClass in its class chain, otherwise false.
final
jSValueIsStrictEqual int Function(Pointer<NativeType> ctx, Pointer<NativeType> a, Pointer<NativeType> b)
Tests whether two JavaScript values are strict equal, as compared by the JS === operator. ctx (JSContextRef) The execution context to use. a (JSValueRef) The first value to test. b (JSValueRef) The second value to test. @result (bool) true if the two values are strict equal, otherwise false.
final
jSValueIsString int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the string type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the string type, otherwise false.
final
jSValueIsSymbol int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the symbol type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the symbol type, otherwise false.
final
jSValueIsUndefined int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Tests whether a JavaScript value's type is the undefined type. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to test. @result (bool) true if value's type is the undefined type, otherwise false.
final
jSValueMakeBoolean Pointer<NativeType> Function(Pointer<NativeType> ctx, int boolean)
Creates a JavaScript value of the boolean type. ctx (JSContextRef) The execution context to use. boolean (bool) The bool to assign to the newly created JSValue. @result (JSValueRef) A JSValue of the boolean type, representing the value of boolean.
final
jSValueMakeFromJSONString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> string)
Creates a JavaScript value from a JSON formatted string. ctx (JSContextRef) The execution context to use. string (JSStringRef) The JSString containing the JSON string to be parsed. @result (JSValueRef) A JSValue containing the parsed value, or NULL if the input is invalid.
final
jSValueMakeNull Pointer<NativeType> Function(Pointer<NativeType> ctx)
Creates a JavaScript value of the null type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique null value.
final
jSValueMakeNumber Pointer<NativeType> Function(Pointer<NativeType> ctx, double number)
Creates a JavaScript value of the number type. ctx (JSContextRef) The execution context to use. number (double) The double to assign to the newly created JSValue. @result (JSValueRef) A JSValue of the number type, representing the value of number.
final
jSValueMakeString Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> string)
Creates a JavaScript value of the string type. ctx (JSContextRef) The execution context to use. string (JSStringRef) The JSString to assign to the newly created JSValue. The newly created JSValue retains string, and releases it upon garbage collection. @result (JSValueRef) A JSValue of the string type, representing the value of string.
final
jSValueMakeSymbol Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> description)
Creates a JavaScript value of the symbol type. ctx (JSContextRef) The execution context to use. description (JSStringRef) A description of the newly created symbol value. @result (JSValueRef) A unique JSValue of the symbol type, whose description matches the one provided.
final
jSValueMakeUndefined Pointer<NativeType> Function(Pointer<NativeType> ctx)
Creates a JavaScript value of the undefined type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique undefined value.
final
jSValueProtect → void Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Protects a JavaScript value from garbage collection. 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. [...]
final
jSValueToBoolean int Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Converts a JavaScript value to boolean and returns the resulting boolean. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. @result (bool) The boolean result of conversion.
final
jSValueToNumber double Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to number and returns the resulting number. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (double) The numeric result of conversion, or NaN if an exception is thrown.
final
jSValueToObject Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to object and returns the resulting object. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) The JSObject result of conversion, or NULL if an exception is thrown.
final
jSValueToStringCopy Pointer<NativeType> Function(Pointer<NativeType> ctx, Pointer<NativeType> value, Pointer<NativeType> exception)
Converts a JavaScript value to string and copies the result into a JavaScript string. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to convert. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSStringRef) A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
final
jSValueUnprotect → void Function(Pointer<NativeType> ctx, Pointer<NativeType> value)
Unprotects a JavaScript value from garbage collection. A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. ctx (JSContextRef) The execution context to use. value (JSValueRef) The JSValue to unprotect.
final