Pepper_47_C_interfaces
Public Attributes | List of all members
PPP_Messaging_1_0 Struct Reference

#include <ppp_messaging.h>

Collaboration diagram for PPP_Messaging_1_0:
Collaboration graph

Public Attributes

void(* HandleMessage )(PP_Instance instance, struct PP_Var message)
 

Detailed Description

The PPP_Messaging interface contains pointers to functions that you must implement to handle postMessage events on the associated DOM element.

Definition at line 38 of file ppp_messaging.h.

Member Data Documentation

void(* PPP_Messaging_1_0::HandleMessage)(PP_Instance instance, struct PP_Var message)

HandleMessage() is a function that the browser calls when PostMessage() is invoked on the DOM element for the module instance in JavaScript. Note that PostMessage() in the JavaScript interface is asynchronous, meaning JavaScript execution will not be blocked while HandleMessage() is processing the message.

Parameters
[in]instanceA PP_Instance identifying one instance of a module.
[in]messageA PP_Var 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.

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.

The following JavaScript code invokes HandleMessage, passing the module instance on which it was invoked, with message being a string PP_Var containing "Hello world!"

Example:

<body>
<object id="plugin"
type="application/x-ppapi-postMessage-example"/>
<script type="text/javascript">
document.getElementById('plugin').postMessage("Hello world!");
</script>
</body>

Definition at line 78 of file ppp_messaging.h.


The documentation for this struct was generated from the following file: