clone3 commited on
Commit
cbb9f14
1 Parent(s): 49b9e4a

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +27 -0
index.html ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Terminal Emulator</title>
7
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css">
8
+ </head>
9
+ <body>
10
+ <div id="terminal"></div>
11
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script>
12
+ <script>
13
+ const term = new Terminal({ cursorBlink: true });
14
+ term.open(document.getElementById('terminal'));
15
+
16
+ const socket = new WebSocket('ws://localhost:6060');
17
+
18
+ term.onData((input) => {
19
+ socket.send(input);
20
+ });
21
+
22
+ socket.onmessage = (event) => {
23
+ term.write(event.data);
24
+ };
25
+ </script>
26
+ </body>
27
+ </html>