Index: ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html |
=================================================================== |
--- ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html (revision 0) |
+++ ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html (revision 0) |
@@ -0,0 +1,67 @@ |
+<!DOCTYPE html> |
+<html> |
+ <!-- |
+ Copyright (c) 2011 The Native Client Authors. All rights reserved. |
+ Use of this source code is governed by a BSD-style license that can be |
+ found in the LICENSE file. |
+ --> |
+<head> |
+ <title>PPAPI InputEvent test</title> |
+ |
+ <script type="text/javascript"> |
+ function $(id) { |
+ return document.getElementById(id); |
+ } |
+ |
+ var events = ''; |
+ |
+ function receiveMessage(message) { |
+ events += message.data; |
+ } |
+ |
+ function getEvents() { |
+ try { |
+ var event_dump = $('event_dump'); |
+ event_dump.firstChild.nodeValue = events; |
+ events = ''; |
+ } catch(e) { |
+ alert(e.message); |
+ } |
+ } |
+ </script> |
+</head> |
+<body> |
+<h1>InputEvent Handling Example</h1> |
+ <div id="listener"> |
+ <script type="text/javascript"> |
+ $('listener').addEventListener('message', receiveMessage, true); |
+ </script> |
+ |
+ <embed name="nacl_module" |
+ id="event_module" |
+ width=400 height=400 |
+ src="ppapi_example_events.nmf" |
+ type="application/x-nacl" |
+ style="background-color:gray" /> |
+ </div> |
+<p> |
+This example demonstrates handling of input events in PPAPI. |
+<p> |
+Each time an input event happens in the context of the gray box, |
+the embedded NaCl module prints a message describing the event to the shell |
+where you started your Browser. |
+<p> |
+Alternatively, you can click the "Get Events" button to display |
+all input events that have happened since the last time you clicked the |
+button. |
+</p> |
+<form name="event_form" action="" method="get"> |
+ <input type="button" value="Get Events" onclick="getEvents()"/> |
+</form> |
+ |
+<h2>Recent Events (press button to update):</h2> |
+<pre id=event_dump> |
+no events |
+</pre> |
+</body> |
+</html> |