This article needs a technical review. How you can help.
JSConvertOp is the type of
typedef bool (* JSConvertOp)(JSContext *cx, JS::HandleObject obj, JSType type, JS::MutableHandleValue vp);
||The context in which the convert is taking place.|
||The object to be converted.|
||The hint to pass to the
||Out parameter. On success,
JSConvertOp callback specifies conversion behavior for objects having this class, implementing the ECMAScript
[[DefaultValue]] behavior for them. On success it must return a primitive value in
Implementations of this hook have historically been required to accept any type. However, the engine itself only requires support for
JS_ConvertValue is not used. If you do not use the
JS_ConvertValue method, you may omit support for other types. (Support for the other types may eventually be removed.)
The callback returns
true to indicate success or
false to indicate failure.
JSClass offers the following hook:
JSClass.convertcallback implements the
[[DefaultValue]]behavior for objects having that class.