Visit Mozilla.org

JS GET CLASS

From MDC

(Redirected from JS GetClass)

Retrieves the class associated with an object.

[edit] Syntax

#define JS_GET_CLASS(cx, obj)  /* ... */

#ifdef JS_THREADSAFE
JSClass * JS_GetClass(JSContext *cx, JSObject *obj);
#else
JSClass * JS_GetClass(JSObject *obj);
#endif
Name Type Description
cx JSContext * Any context associated with the runtime in which obj exists.
obj JSObject * Object to get the class from.

[edit] Description

JS_GetClass returns a pointer to the JSClass associated with a specified JS object, obj. The application must treat the JSClass as read-only. If obj has no JSClass, this returns NULL.

The signature of JS_GetClass depends on build settings. Use the JS_GET_CLASS macro instead for maximum compatibility across build environments.

To check the type of an object, use JS_HasInstance instead. For a stricter, exact-match-only check, use JS_InstanceOf or JS_GetInstancePrivate.

LXR ID Search for JS_GET_CLASS
LXR ID Search for JS_GetClass