JS_SetCallReturnValue2

  • Revision slug: SpiderMonkey/JSAPI_Reference/JS_SetCallReturnValue2
  • Revision title: JS_SetCallReturnValue2
  • Revision id: 146753
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment 14 words removed

Revision Content

Causes a native to return a Reference value (as allowed by {{ Es3_spec("11.2.3") }}).

Syntax

void JS_SetCallReturnValue2(JSContext *cx, jsval v);
Name Type Description
cx JSContext * The context in which the native function is running.
v jsval The ID of the property of the Reference value to be returned from the native.

Description

Calling JS_SetCallReturnValue2 indicates to the runtime that the native will return a value of type Reference.

The native must store the object part of the Reference value in *rval, and the argument v gives the ID of the property part of the Reference value. This Reference value can then be used as an lvalue in script.

An example is in {{ Source("js/src/js.c") }}; searching for JS_SetCallReturnValue2 should find it.

{{ LXRSearch("ident", "i", "JS_SetCallReturnValue2") }}

Revision Source

<p>Causes a native to return a Reference value (as allowed by {{ Es3_spec("11.2.3") }}).
</p>
<h2 id="Syntax" name="Syntax"> Syntax </h2>
<pre class="eval">void <strong>JS_SetCallReturnValue2</strong>(<a href="/en/SpiderMonkey/JSAPI_Reference/JSRuntime" title="en/JSRuntime">JSContext</a> *cx, <a href="/En/SpiderMonkey/JSAPI_Reference/Jsval" title="en/jsval">jsval</a> v);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>cx</code></td>
<td><code><a href="/en/SpiderMonkey/JSAPI_Reference/JSRuntime" title="en/JSRuntime">JSContext</a> *</code></td>
<td>The context in which the native function is running.</td>
</tr>
<tr>
<td><code>v</code></td>
<td><code>jsval</code></td>
<td>The ID of the property of the Reference value to be returned from the native.</td>
</tr>
</tbody></table>
<h2 id="Description" name="Description"> Description </h2>
<p>Calling <code>JS_SetCallReturnValue2</code> indicates to the runtime that the native will return a value of type Reference.
</p><p>The native must store the object part of the Reference value in <code>*rval</code>, and the argument <code>v</code> gives the ID of the property part of the Reference value. This Reference value can then be used as an lvalue in script.
</p><p>An example is in {{ Source("js/src/js.c") }}; searching for <code>JS_SetCallReturnValue2</code> should find it.
</p><p>{{ LXRSearch("ident", "i", "JS_SetCallReturnValue2") }}
</p>
Revert to this revision