mozilla

Revision 144984 of JS GET CLASS

  • Revision slug: JS_GET_CLASS
  • Revision title: JS GET CLASS
  • Revision id: 144984
  • Created:
  • Creator: Dria
  • Is current revision? No
  • Comment

Revision Content

{{template.Jsapiref()}}

Summary

Function

Retrieves the class associated with an object.

Syntax

JSClass * JS_GetClass(JSObject *obj);

Alternative syntax when JS_THREADSAFE is defined in a multithreaded environment:

JSClass * JS_GetClass(JSContext *cx, JSObject *obj)
Name Type Description
obj JSObject * Object to get the class from.
cx JSContext * Used only if JS_THREADSAFE is defined. Should be a thread context.

Description

JS_GetClass returns a pointer to the class associated with a specified JS object, obj. The class is an internal JS data structure that you can create for objects as needed. Generally you do not expose a class in your applications, but use it behind the scenes.

If your application runs in a multithreaded environment, define JS_THREADSAFE, and pass a thread context as the first argument to JS_GetClass.

If an object has a class, JS_GetClass returns a pointer to the class structure. Otherwise, it returns NULL.

See Also

Groups Functions
Documents {{template.LXRSearch("ident", "i", "JS_GetClass", "LXR ID Search")}}
Entries

JSClass, JS_InitClass, JS_InstanceOf

Revision Source

<p> 
{{template.Jsapiref()}}
</p>
<h2 name="Summary"> Summary </h2>
<p><b>Function</b>
</p><p>Retrieves the class associated with an object.
</p>
<h2 name="Syntax"> Syntax </h2>
<pre class="eval">JSClass * JS_GetClass(JSObject *obj);
</pre>
<p>Alternative syntax when <code><a href="en/JS_THREADSAFE">JS_THREADSAFE</a></code> is defined in a multithreaded environment:
</p>
<pre class="eval">JSClass * JS_GetClass(JSContext *cx, JSObject *obj)
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>obj</code></td>
<td><code>JSObject *</code></td>
<td>Object to get the class from.</td>
</tr>
<tr>
<td><code>cx</code></td>
<td><code>JSContext *</code></td>
<td>Used <b>only</b> if <code>JS_THREADSAFE</code> is defined. Should be a thread context.</td>
</tr>
</tbody></table>
<h2 name="Description"> Description </h2>
<p><code>JS_GetClass</code> returns a pointer to the class associated with a specified JS object, <code>obj</code>. The class is an internal JS data structure that you can create for objects as needed. Generally you do not expose a class in your applications, but use it behind the scenes.
</p><p>If your application runs in a multithreaded environment, define <code>JS_THREADSAFE</code>, and pass a thread context as the first argument to <code>JS_GetClass</code>.
</p><p>If an object has a class, <code>JS_GetClass</code> returns a pointer to the class structure. Otherwise, it returns <code>NULL</code>.
</p>
<h2 name="See_Also"> See Also </h2>
<table class="fullwidth-table">
<tbody><tr>
<td>Groups</td>
<td><a href="en/JSAPI_Reference#Functions">Functions</a></td>
</tr>
<tr>
<td>Documents</td>
<td>{{template.LXRSearch("ident", "i", "JS_GetClass", "LXR ID Search")}}</td>
</tr>
<tr>
<td>Entries</td>
<td>
<p><a href="en/JSAPI_Reference/JSClass">JSClass</a>,
<a href="en/JSAPI_Reference/JS_InitClass">JS_InitClass</a>,
<a href="en/JSAPI_Reference/JS_InstanceOf">JS_InstanceOf</a>
</p>
</td>
</tr>
</tbody></table>
Revert to this revision