|
Mac Dev Center
Mac OS X Reference Library Networking, Internet, & Web JavaScriptCore Framework Reference
|
JSValueRef.h |
| Includes: | <JavaScriptCore/JSBase.h> <stdbool.h> |
Use the links in the table of contents to the left to access the documentation.
Returns a JavaScript value's type.
Tests whether a JavaScript value's type is the boolean type.
Tests whether two JavaScript values are equal, as compared by the JS == operator.
Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
Tests whether a JavaScript value's type is the null type.
Tests whether a JavaScript value's type is the number type.
Tests whether a JavaScript value's type is the object type.
Tests whether a JavaScript value is an object with a given class in its class chain.
Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
Tests whether a JavaScript value's type is the string type.
Tests whether a JavaScript value's type is the undefined type.
Creates a JavaScript value of the boolean type.
Creates a JavaScript value of the null type.
Creates a JavaScript value of the number type.
Creates a JavaScript value of the string type.
Creates a JavaScript value of the undefined type.
Protects a JavaScript value from garbage collection.
Converts a JavaScript value to boolean and returns the resulting boolean.
Converts a JavaScript value to number and returns the resulting number.
Converts a JavaScript value to object and returns the resulting object.
Converts a JavaScript value to string and copies the result into a JavaScript string.
Unprotects a JavaScript value from garbage collection.
JSValueGetType |
Returns a JavaScript value's type.
JS_EXPORT JSType JSValueGetType( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue whose type you want to obtain.
A value of type JSType that identifies value's type.
JSValueIsBoolean |
Tests whether a JavaScript value's type is the boolean type.
JS_EXPORT bool JSValueIsBoolean( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
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.
JS_EXPORT bool JSValueIsEqual( JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef *exception);
ctxThe execution context to use.
aThe first value to test.
bThe second value to test.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an 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.
JS_EXPORT bool JSValueIsInstanceOfConstructor( JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef *exception);
ctxThe execution context to use.
valueThe JSValue to test.
constructorThe constructor to test against.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an 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.
JS_EXPORT bool JSValueIsNull( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
true if value's type is the null type, otherwise false.
JSValueIsNumber |
Tests whether a JavaScript value's type is the number type.
JS_EXPORT bool JSValueIsNumber( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
true if value's type is the number type, otherwise false.
JSValueIsObject |
Tests whether a JavaScript value's type is the object type.
JS_EXPORT bool JSValueIsObject( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
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.
JS_EXPORT bool JSValueIsObjectOfClass( JSContextRef ctx, JSValueRef value, JSClassRef jsClass);
ctxThe execution context to use.
valueThe JSValue to test.
jsClassThe JSClass to test against.
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.
JS_EXPORT bool JSValueIsStrictEqual( JSContextRef ctx, JSValueRef a, JSValueRef b);
ctxThe execution context to use.
aThe first value to test.
bThe second value to test.
true if the two values are strict equal, otherwise false.
JSValueIsString |
Tests whether a JavaScript value's type is the string type.
JS_EXPORT bool JSValueIsString( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
true if value's type is the string type, otherwise false.
JSValueIsUndefined |
Tests whether a JavaScript value's type is the undefined type.
JS_EXPORT bool JSValueIsUndefined( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to test.
true if value's type is the undefined type, otherwise false.
JSValueMakeBoolean |
Creates a JavaScript value of the boolean type.
JS_EXPORT JSValueRef JSValueMakeBoolean( JSContextRef ctx, bool boolean);
ctxThe execution context to use.
booleanThe bool to assign to the newly created JSValue.
A JSValue of the boolean type, representing the value of boolean.
JSValueMakeNull |
Creates a JavaScript value of the null type.
JS_EXPORT JSValueRef JSValueMakeNull( JSContextRef ctx);
ctxThe execution context to use.
The unique null value.
JSValueMakeNumber |
Creates a JavaScript value of the number type.
JS_EXPORT JSValueRef JSValueMakeNumber( JSContextRef ctx, double number);
ctxThe execution context to use.
numberThe double to assign to the newly created JSValue.
A JSValue of the number type, representing the value of number.
JSValueMakeString |
Creates a JavaScript value of the string type.
JS_EXPORT JSValueRef JSValueMakeString( JSContextRef ctx, JSStringRef string);
ctxThe execution context to use.
stringThe JSString to assign to the newly created JSValue. The newly created JSValue retains string, and releases it upon garbage collection.
A JSValue of the string type, representing the value of string.
JSValueMakeUndefined |
Creates a JavaScript value of the undefined type.
JS_EXPORT JSValueRef JSValueMakeUndefined( JSContextRef ctx);
ctxThe execution context to use.
The unique undefined value.
JSValueProtect |
Protects a JavaScript value from garbage collection.
JS_EXPORT void JSValueProtect( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe 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.
JSValueToBoolean |
Converts a JavaScript value to boolean and returns the resulting boolean.
JS_EXPORT bool JSValueToBoolean( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to convert.
The boolean result of conversion.
JSValueToNumber |
Converts a JavaScript value to number and returns the resulting number.
JS_EXPORT double JSValueToNumber( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctxThe execution context to use.
valueThe JSValue to convert.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an 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.
JS_EXPORT JSObjectRef JSValueToObject( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctxThe execution context to use.
valueThe JSValue to convert.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an 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.
JS_EXPORT JSStringRef JSValueToStringCopy( JSContextRef ctx, JSValueRef value, JSValueRef *exception);
ctxThe execution context to use.
valueThe JSValue to convert.
exceptionA pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an 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.
JS_EXPORT void JSValueUnprotect( JSContextRef ctx, JSValueRef value);
ctxThe execution context to use.
valueThe JSValue to unprotect.
A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
A constant identifying the type of a JSValue.
JSType |
A constant identifying the type of a JSValue.
typedef enum { kJSTypeUndefined, kJSTypeNull, kJSTypeBoolean, kJSTypeNumber, kJSTypeString, kJSTypeObject } JSType;
kJSTypeUndefinedThe unique undefined value.
kJSTypeNullThe unique null value.
kJSTypeBooleanA primitive boolean value, one of true or false.
kJSTypeNumberA primitive number value.
kJSTypeStringA primitive string value.
kJSTypeObjectAn object value (meaning that this JSValueRef is a JSObjectRef).
Last Updated: 2009-08-12