diff options
Diffstat (limited to 'std/examples')
-rw-r--r-- | std/examples/chat/index.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/std/examples/chat/index.html b/std/examples/chat/index.html index b26a4a15d..2daf288b3 100644 --- a/std/examples/chat/index.html +++ b/std/examples/chat/index.html @@ -29,10 +29,14 @@ connectButton.onclick=connect; const status = document.getElementById("status"); const input = document.getElementById("input"); + input.addEventListener("keydown", keyDownEvent); function send() { const msg = input.value; ws.send(msg); - applyState({inputValue: ""}) + applyState({inputValue: ""}); + } + function keyDownEvent(e) { + if (e.keyCode === 13) return send(); } function connect() { if (ws) ws.close(); |