Entry: JS_InstanceOf (Function)
Summary: Determines if an object is an instance of a specified JS class.
Syntax:
JSBool JS_InstanceOf(JSContext *cx, JSObject *obj,
JSClass *clasp, jsval *argv);
Argument Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information.
obj JSObject * Object to test.
clasp JSClass * Class against which to test the object.
argv jsval * Optional argument vector. If you do not want to pass an argument vector, pass NULL for this argument.
Description:
JS_InstanceOf determines if a specified JS object, obj, has a JS class struct, clasp. If the object's internal class pointer corresponds to clasp, this function returns JS_TRUE, indicating that the object is an instance of the class. Otherwise, JS_InstanceOf returns JS_FALSE.
If you pass a non-null argument vector, argv, to JS_InstanceOf, and obj is not an instance of clasp, this function may report a class mismatch before returning. To do so, JS_InstanceOf tests whether or not there is a function name associated with the argument vector, and if there is, reports the name in an error message using the JS_ReportError function.
See also:
|
|
|