User Guide
The C-level API 381
JSBool JS_DoubleToValue()
Usage
JSBool JS_DoubleToValue(JSContext *cx, double dv, jsval *vp);
Description
Method; stores a floating-point number return value in a jsval structure.
Arguments
JSContext *cx
, double dv, jsval *vp
• The cx argument is the opaque JSContext pointer that passes to the JavaScript function.
• The dv argument is an 8-byte floating-point number.
• The vp argument is a pointer to the jsval structure into which the contents of the double
should be copied.
Returns
A Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.
JSVal JS_BooleanToValue()
Usage
jsval JS_BooleanToValue(JSBool bv);
Description
Method; 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_BytesToValue()
Usage
JSBool JS_BytesToValue(JSContext *cx, unsigned short *bytes, uint sz, jsval
*vp);
Description
Method; converts bytes to a JavaScript value.
Arguments
JSContext
*cx, unsigned short bytes, uint sz, jsval *vp
• The cx argument is the JavaScript context.
• The bytes argument is the string of bytes to convert to a JavaScript object.