diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig index 328bcea..b8a0715 100644 --- a/src/main.zig +++ b/src/main.zig @@ -72,7 +72,7 @@ fn handle_request(alloc: std.mem.Allocator, io: Io, stream: Io.net.Stream) void \\ button { width: 80px; height: 40px; } \\ </style></head><body> \\ <script> - \\ const socket = new WebSocket(`wss://${window.location.host}``); + \\ const socket = new WebSocket(`wss://${window.location.host}`); \\ socket.addEventListener("open", (event) => { \\ tv.value += "Connected!\n"; \\ }); @@ -85,9 +85,10 @@ fn handle_request(alloc: std.mem.Allocator, io: Io, stream: Io.net.Stream) void \\ socket.send(`${tn.value}: ${tb.value}`); \\ tb.value = ""; \\ } + \\ tb.onkeypress = (e) => if (e.key === "Enter") Send(); \\ </script> \\ <textarea id="tv" readonly></textarea> - \\ <div><input type="text" id="tn" /><input type="text" id="tb" onkeypress="if (e.key === 'Enter') Send()" /> + \\ <div><input type="text" id="tn" /><input type="text" id="tb" /> \\ <button onclick="Send()">Send</button></div> \\ </body></html> , .{ .status = .ok }) catch break; |
