Entry: JS_GetInstancePrivate (Function)
Summary: Retrieves the private data associated with an object if that object is an instance of a class.
Syntax:
void * JS_GetInstancePrivate(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 for which to retrieve private data.
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_GetInstancePrivate determines if a specified JS object, obj, is an instance of a JS class, clasp, and if it is, returns a pointer to the object's private data. If the object's internal class pointer corresponds to clasp, and you do not also pass an optional argument vector, argv, this function attempts to retrieve a pointer to the private data. Otherwise, it returns NULL.
If you pass a non-null argument vector, argv, to JS_GetInstancePrivate, and obj is not an instance of clasp, this function reports a class mismatch before returning NULL. In this case, JS_GetInstancePrivate 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:
|
|
|