| Index: ppapi/c/ppb_instance.h
|
| ===================================================================
|
| --- ppapi/c/ppb_instance.h (revision 77328)
|
| +++ ppapi/c/ppb_instance.h (working copy)
|
| @@ -10,7 +10,7 @@
|
| #include "ppapi/c/pp_resource.h"
|
| #include "ppapi/c/pp_var.h"
|
|
|
| -#define PPB_INSTANCE_INTERFACE "PPB_Instance;0.4"
|
| +#define PPB_INSTANCE_INTERFACE "PPB_Instance;0.5"
|
|
|
| /**
|
| * @file
|
| @@ -107,6 +107,50 @@
|
| struct PP_Var (*ExecuteScript)(PP_Instance instance,
|
| struct PP_Var script,
|
| struct PP_Var* exception);
|
| +
|
| + /**
|
| + * @a PostMessage is a pointer to a function which asynchronously invokes th
|
| + * onmessage handler on the DOM element for this module instance, if one
|
| + * exists. @a message is a PP_Var containing the data to be sent to
|
| + * JavaScript. Currently, it can have an int32_t, double, bool, or string
|
| + * value (objects are not currently supported.)
|
| + *
|
| + * The onmessage handler in JavaScript code will receive an object conforming
|
| + * to the MessageEvent interface. In particular, the value of @a message will
|
| + * be contained as a property called @a data in the received MessageEvent.
|
| + * This is analogous to listening for messages from Web Workers.
|
| + *
|
| + * See:
|
| + * http://www.whatwg.org/specs/web-workers/current-work/
|
| + *
|
| + * For example:
|
| + *
|
| + * \verbatim
|
| + *
|
| + * <body>
|
| + * <object id="plugin"
|
| + * type="application/x-ppapi-postMessage-example"/>
|
| + * <script type="text/javascript">
|
| + * document.getElementById('plugin').onmessage = function(message) {
|
| + * alert(message.data);
|
| + * }
|
| + * </script>
|
| + * </body>
|
| + *
|
| + * \endverbatim
|
| + *
|
| + * If the module instance then invokes @a PostMessage() as follows:
|
| + * <code>
|
| + * char hello_world[] = "Hello world!";
|
| + * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance,
|
| + * hello_world,
|
| + * sizeof(hello_world));
|
| + * the_ppb_instance->PostMessage(instance, hello_var);
|
| + * </code>
|
| + *
|
| + * The browser will pop-up an alert saying "Hello world!".
|
| + */
|
| + void (*PostMessage)(PP_Instance instance, struct PP_Var message);
|
| };
|
| /**
|
| * @}
|
|
|