typing indicator
parent
75d330088e
commit
b5942a90ea
|
|
@ -86,6 +86,8 @@
|
|||
print(data.Text);
|
||||
} else if (data.QuietText) {
|
||||
print(data.QuietText);
|
||||
} else if (data.Typing) {
|
||||
print("(someone is typing...)")
|
||||
}
|
||||
}
|
||||
function ws_onerror(evt) {
|
||||
|
|
@ -131,6 +133,21 @@
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var typing_clear_timeout = 0;
|
||||
input.onkeyup = function() {
|
||||
if (input.value) {
|
||||
if (!typing_clear_timeout) {
|
||||
ws.send(`{"Typing":true}`);
|
||||
} else {
|
||||
clearTimeout(typing_clear_timeout);
|
||||
}
|
||||
typing_clear_timeout = setTimeout(() => {
|
||||
ws.send(`{"Typing":false}`);
|
||||
typing_clear_timeout = 0;
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package server
|
|||
type message struct {
|
||||
Text string
|
||||
QuietText string
|
||||
Typing bool
|
||||
Pitch int
|
||||
Rate float64
|
||||
VoiceIdx int
|
||||
|
|
|
|||
Loading…
Reference in New Issue