Chromium Code Reviews| Index: ppapi/examples/scripting/post_message.html |
| =================================================================== |
| --- ppapi/examples/scripting/post_message.html (revision 0) |
| +++ ppapi/examples/scripting/post_message.html (revision 0) |
| @@ -0,0 +1,37 @@ |
| +<body> |
|
polina
2011/03/22 22:00:59
no html, title, etc?
dmichael(do not use this one)
2011/03/23 17:03:18
Sorry, was just copying the ppapi/example/example.
|
| + |
| +<script type="text/javascript"> |
| + |
| +function SendString() { |
| + plugin = document.getElementById('plugin'); |
| + |
| + // If we haven't already done it, set up an 'onmessage' function. This will |
| + // get invoked whenever the plugin calls Instance::PostMessage in C++ (or |
| + // PPB_Instance::PostMessage in C). In this case, we're expecting a bool to |
|
polina
2011/03/22 22:00:59
PPB_Messaging
dmichael(do not use this one)
2011/03/23 17:03:18
Done.
|
| + // tell us whether the string we passed was a palindrome. |
| + if (!plugin.onmessage) { |
| + plugin.onmessage = function(message_event) { |
| + if (message_event.data) { |
| + alert("The string was a palindrome."); |
| + } else { |
| + alert("The string was not a palindrome."); |
| + } |
| + } |
| + } |
| + |
| + var inputBox = document.getElementById("inputBox"); |
| + |
| + // Send the string to the plugin using postMessage. This results in a call |
| + // to Instance::HandleMessage in C++ (or PPP_Instance::HandleMessage in C). |
|
polina
2011/03/22 22:00:59
PPP_Messaging
dmichael(do not use this one)
2011/03/23 17:03:18
Done.
|
| + plugin.postMessage(inputBox.value); |
| +} |
| + |
| +</script> |
| + |
| +<input type="text" id="inputBox" name="inputBox" value="ablewasiereisawelba"/> |
| +<p> |
| +<button onclick='SendString()'>Is Palindrome</button> |
| +<object id="plugin" type="application/x-ppapi-post-message-example" |
| + width="0" height="0"/> |
| +<hr> |
| +</body> |
| Property changes on: ppapi/examples/scripting/post_message.html |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |