Index: ppapi/c/ppb_instance.h |
=================================================================== |
--- ppapi/c/ppb_instance.h (revision 75765) |
+++ 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,44 @@ |
struct PP_Var (*ExecuteScript)(PP_Instance instance, |
struct PP_Var script, |
struct PP_Var* exception); |
+ |
+ /** |
+ * @a PostMessage asynchronously invokes the onmessage handler on the DOM |
polina
2011/03/03 00:22:16
Btw, note that our tech writers are changing all t
|
+ * 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 |
polina
2011/03/03 00:22:16
Thanks for the helpful clarification.
I would say
|
+ * 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: |
+ * |
+ * <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> |
+ * |
+ * If the module instance then invokes @a PostMessage() as follows: |
+ * 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); |
+ * |
+ * The browser will pop-up an alert saying "Hello world!". |
+ */ |
+ void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
}; |
/** |
* @} |