diff options
| author | Patrick | 2026-05-08 10:52:28 +0200 |
|---|---|---|
| committer | Patrick | 2026-05-08 10:52:28 +0200 |
| commit | 6f098cea40bc3df947618e69494acd7a9586330c (patch) | |
| tree | 8464b54ec1ae84a616d8dd13e7b967a00fcf4bc4 /src/main.zig | |
| parent | 88b339f3c3916c856351821b37823f70e822ea57 (diff) | |
| download | zhttpws-6f098cea40bc3df947618e69494acd7a9586330c.tar.gz zhttpws-6f098cea40bc3df947618e69494acd7a9586330c.zip | |
update ui
Diffstat (limited to 'src/main.zig')
| -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; |
