[PATCH 3/3] Updated example files with SPICE port event listeners

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 spice.html      | 10 ++++++++++
 spice_auto.html | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/spice.html b/spice.html
index c473678..f9a91c0 100644
--- a/spice.html
+++ b/spice.html
@@ -42,6 +42,7 @@
         <script src="wire.js"></script>
         <script src="spiceconn.js"></script>
         <script src="display.js"></script>
+        <script src="port.js"></script>
         <script src="main.js"></script>
         <script src="inputs.js"></script>
         <script src="webm.js"></script>
@@ -142,6 +143,15 @@
                 }
             }
 
+            window.addEventListener('spice-port-data', function(event) {
+                var msg_text = new TextDecoder('utf-8').decode(new Uint8Array(event.detail.data));
+                console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);
+            });
+
+            window.addEventListener('spice-port-event', function(event) {
+                console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);
+            });
+
         </script>
 
     </head>
diff --git a/spice_auto.html b/spice_auto.html
index 1179ebe..48a6bda 100644
--- a/spice_auto.html
+++ b/spice_auto.html
@@ -42,6 +42,7 @@
         <script src="wire.js"></script>
         <script src="spiceconn.js"></script>
         <script src="display.js"></script>
+        <script src="port.js"></script>
         <script src="main.js"></script>
         <script src="inputs.js"></script>
         <script src="webm.js"></script>
@@ -182,6 +183,15 @@
                 }
             }
 
+            window.addEventListener('spice-port-data', function(event) {
+                var msg_text = new TextDecoder('utf-8').decode(new Uint8Array(event.detail.data));
+                console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);
+            });
+
+            window.addEventListener('spice-port-event', function(event) {
+                console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);
+            });
+
             connect();
         </script>
 
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]