ADC Home > Reference Library > Reference > Carbon > Internet & Web > JavaScriptCore Framework Reference
|
JSValueRef.h |
Includes: | <JavaScriptCore/JSBase.h> <stdbool.h> |
JSValueGetType |
Returns a JavaScript value's type.
JSType JSValueGetType( JSContextRef ctx, JSValueRef value);
ctx
value
A value of type JSType that identifies value's type.
JSValueIsBoolean |
Tests whether a JavaScript value's type is the boolean type.
bool JSValueIsBoolean( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the boolean type, otherwise false.
JSValueIsEqual |
Tests whether two JavaScript values are equal, as compared by the JS == operator.
bool JSValueIsEqual( JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef *exception);
ctx
a
b
exception
true if the two values are equal, false if they are not equal or an exception is thrown.
JSValueIsInstanceOfConstructor |
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
bool JSValueIsInstanceOfConstructor( JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef *exception);
ctx
value
constructor
exception
true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
JSValueIsNull |
Tests whether a JavaScript value's type is the null type.
bool JSValueIsNull( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the null type, otherwise false.
JSValueIsNumber |
Tests whether a JavaScript value's type is the number type.
bool JSValueIsNumber( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the number type, otherwise false.
JSValueIsObject |
Tests whether a JavaScript value's type is the object type.
bool JSValueIsObject( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the object type, otherwise false.
JSValueIsObjectOfClass |
Tests whether a JavaScript value is an object with a given class in its class chain.
bool JSValueIsObjectOfClass( JSContextRef ctx, JSValueRef value, JSClassRef jsClass);
ctx
value
jsClass
true if value is an object and has jsClass in its class chain, otherwise false.
JSValueIsStrictEqual |
Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
bool JSValueIsStrictEqual( JSContextRef ctx, JSValueRef a, JSValueRef b);
ctx
a
b
true if the two values are strict equal, otherwise false.
JSValueIsString |
Tests whether a JavaScript value's type is the string type.
bool JSValueIsString( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the string type, otherwise false.
JSValueIsUndefined |
Tests whether a JavaScript value's type is the undefined type.
bool JSValueIsUndefined( JSContextRef ctx, JSValueRef value);
ctx
value
true if value's type is the undefined type, otherwise false.
JSValueMakeBoolean |
Creates a JavaScript value of the boolean type.
JSValueRef JSValueMakeBoolean( JSContextRef ctx, bool boolean);
ctx
boolean
A JSValue of the boolean type, representing the value of boolean.
JSValueMakeNull |
Creates a JavaScript value of the null type.
JSValueRef JSValueMakeNull( JSContextRef ctx);
ctx
The unique null value.
JSValueMakeNumber |
Creates a JavaScript value of the number type.
JSValueRef JSValueMakeNumber( JSContextRef ctx, double number);
ctx
number
A JSValue of the number type, representing the value of number.
JSValueMakeString |
Creates a JavaScript value of the string type.
JSValueRef JSValueMakeString( JSContextRef ctx, JSStringRef string);
ctx
string
A JSValue of the string type, representing the value of string.
JSValueMakeUndefined |
Creates a JavaScript value of the undefined type.
JSValueRef JSValueMakeUndefined( JSContextRef ctx);
ctx
The unique undefined value.
JSValueProtect |
Protects a JavaScript value from garbage collection.
void JSValueProtect( JSContextRef ctx, JSValueRef value);
ctx
value
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.
JSValueToBoolean |
Converts a JavaScript value to boolean and returns the resulting boolean.
bool JSValueToBoolean( JSContextRef ctx, JSValueRef value);
ctx
value
The boolean result of conversion.
JSValueToNumber |
Converts a JavaScript value to number and returns the resulting number.
double JSValueToNumber( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctx
value
exception
The numeric result of conversion, or NaN if an exception is thrown.
JSValueToObject |
Converts a JavaScript value to object and returns the resulting object.
JSObjectRef JSValueToObject( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctx
value
exception
The JSObject result of conversion, or NULL if an exception is thrown.
JSValueToStringCopy |
Converts a JavaScript value to string and copies the result into a JavaScript string.
JSStringRef JSValueToStringCopy( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctx
value
exception
A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
JSValueUnprotect |
Unprotects a JavaScript value from garbage collection.
void JSValueUnprotect( JSContextRef ctx, JSValueRef value);
ctx
value
A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
JSType |
A constant identifying the type of a JSValue.
typedef enum { kJSTypeUndefined, kJSTypeNull, kJSTypeBoolean, kJSTypeNumber, kJSTypeString, kJSTypeObject } JSType;
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).
|