binding/JSValueRef library

Properties

JSValueCreateJSONString JSStringRef Function(JSContextRef ctx, JSValueRef value, int indent, Pointer<JSValueRef> 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(JSContextRef ctx, JSValueRef 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(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef a, JSValueRef b, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, Pointer<JSValueRef> 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef value, JSClassRef 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 bool Function(JSContextRef ctx, JSValueRef a, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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 JSValueRef Function(JSContextRef ctx, bool 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef ctx)
Creates a JavaScript value of the null type. ctx (JSContextRef) The execution context to use. @result (JSValueRef) The unique null value.
final
JSValueMakeNumber JSValueRef Function(JSContextRef 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef ctx, JSStringRef 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 JSValueRef Function(JSContextRef 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(JSContextRef ctx, JSValueRef 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 bool Function(JSContextRef ctx, JSValueRef 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(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 JSObjectRef Function(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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 JSStringRef Function(JSContextRef ctx, JSValueRef value, Pointer<JSValueRef> 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(JSContextRef ctx, JSValueRef 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