typing indicator
parent
75d330088e
commit
b5942a90ea
|
|
@ -86,6 +86,8 @@
|
||||||
print(data.Text);
|
print(data.Text);
|
||||||
} else if (data.QuietText) {
|
} else if (data.QuietText) {
|
||||||
print(data.QuietText);
|
print(data.QuietText);
|
||||||
|
} else if (data.Typing) {
|
||||||
|
print("(someone is typing...)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ws_onerror(evt) {
|
function ws_onerror(evt) {
|
||||||
|
|
@ -131,6 +133,21 @@
|
||||||
}
|
}
|
||||||
return false;
|
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>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package server
|
||||||
type message struct {
|
type message struct {
|
||||||
Text string
|
Text string
|
||||||
QuietText string
|
QuietText string
|
||||||
|
Typing bool
|
||||||
Pitch int
|
Pitch int
|
||||||
Rate float64
|
Rate float64
|
||||||
VoiceIdx int
|
VoiceIdx int
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue