User Guide

360 Chapter 21: C-Level Extensibility
JSVal JS_BooleanToValue()
Description
This function stores a Boolean return value in a jsval structure.
Arguments
JSBool bv
The bv argument is a Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.
Returns
A JSVal structure that contains the Boolean value that passes to the function as an argument.
JSVal JS_IntegerToValue()
Description
This function converts a long integer value to JSVal structure.
Arguments
lv
The lv argument is the long integer value that you want to convert to a jsval structure.
Returns
A JSVal structure that contains the integer that was passed to the function as an argument.
JSVal JS_ObjectToValue()
Description
This function stores an object return value in a JSVal. Use JS_ NewArrayObject() to create an
array object; use
JS_SetElement() to define its contents.
Arguments
JSObject *obj
The obj argument is a pointer to the JSObject object that you want to convert to a JSVal
structure.
Returns
A JSVal structure that contains the object that you passed to the function as an argument.
char *JS_ObjectType()
Description
Given an object reference, the JS_ObjectType() function returns the class name of the object.
For example, if the object is a DOM object, the function returns "Document". If the object is a
node in the document, the function returns "
Element". For an array object, the function
returns "
Array".
Note: Do not modify the returned buffer pointer or you might corrupt the data structures of the
JavaScript interpreter.