chromium/native_client_sdk/doc_generated/pepper_beta/c/struct_p_p_p___messaging__1__0.html

{{+bindTo:partials.standard_nacl_api}}
<h1>PPP_Messaging Struct Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
  <div>
<!-- Generated by Doxygen 1.7.6.1 -->


</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="PPP_Messaging" --><h2>
Data Fields</h2><table class="memberdecls">

<tr><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_p_p_p___messaging__1__0.html#a558ca784cf11eaba479ff8621ae2c507">HandleMessage</a> )(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> message)</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code>PPP_Messaging</code> interface contains pointers to functions that you must implement to handle postMessage events on the associated DOM element. </p>
</div><hr /><h2>Field Documentation</h2>
<a class="anchor" id="a558ca784cf11eaba479ff8621ae2c507"></a><!-- doxytag: member="PPP_Messaging::HandleMessage" ref="a558ca784cf11eaba479ff8621ae2c507" args=")(PP_Instance instance, struct PP_Var message)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void(* <a class="el" href="struct_p_p_p___messaging__1__0.html#a558ca784cf11eaba479ff8621ae2c507">PPP_Messaging::HandleMessage</a>)(<a class="el" href="group___typedefs.html#ga89b662403e6a687bb914b80114c0d19d">PP_Instance</a> instance, struct <a class="el" href="struct_p_p___var.html">PP_Var</a> message)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="struct_p_p_p___messaging__1__0.html#a558ca784cf11eaba479ff8621ae2c507" title="HandleMessage() is a function that the browser calls when PostMessage() is invoked on the DOM element...">HandleMessage()</a> is a function that the browser calls when PostMessage() is invoked on the DOM element for the module instance in JavaScript. </p>
<p>Note that PostMessage() in the JavaScript interface is asynchronous, meaning JavaScript execution will not be blocked while <a class="el" href="struct_p_p_p___messaging__1__0.html#a558ca784cf11eaba479ff8621ae2c507" title="HandleMessage() is a function that the browser calls when PostMessage() is invoked on the DOM element...">HandleMessage()</a> is processing the message.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>A <code>PP_Instance</code> identifying one instance of a module. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">message</td><td>A <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> which has been converted from a JavaScript value. JavaScript array/object types are supported from Chrome M29 onward. All JavaScript values are copied when passing them to the plugin.</td></tr>
</table>
</dd>
</dl>
<p>When converting JavaScript arrays, any object properties whose name is not an array index are ignored. When passing arrays and objects, the entire reference graph will be converted and transferred. If the reference graph has cycles, the message will not be sent and an error will be logged to the console.</p>
<p>The following JavaScript code invokes <code>HandleMessage</code>, passing the module instance on which it was invoked, with <code>message</code> being a string <code><a class="el" href="struct_p_p___var.html" title="The PP_VAR struct is a variant data type and can contain any value of one of the types named in the P...">PP_Var</a></code> containing "Hello world!"</p>
<p><b>Example:</b></p>
<div class="fragment"><pre class="fragment"> &lt;body&gt;
   &lt;<span class="keywordtype">object</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;plugin&quot;</span>
           type=<span class="stringliteral">&quot;application/x-ppapi-postMessage-example&quot;</span>/&gt;
   &lt;script type=<span class="stringliteral">&quot;text/javascript&quot;</span>&gt;
     document.getElementById(<span class="stringliteral">&#39;plugin&#39;</span>).postMessage(<span class="stringliteral">&quot;Hello world!&quot;</span>);
   &lt;/script&gt;
 &lt;/body&gt;
</pre></div>
</div>
</div>
<hr />The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ppp__messaging_8h.html">ppp_messaging.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}