mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Use microtasks on server
This reduces demo input latency on my mac approx 10ms -> 4ms
This commit is contained in:
+2
-2
@@ -86,7 +86,7 @@ function startServer() {
|
||||
return (data) => {
|
||||
s += data;
|
||||
if (!sender) {
|
||||
sender = setTimeout(() => {
|
||||
sender = queueMicrotask(() => {
|
||||
socket.send(s);
|
||||
s = '';
|
||||
sender = null;
|
||||
@@ -103,7 +103,7 @@ function startServer() {
|
||||
buffer.push(data);
|
||||
length += data.length;
|
||||
if (!sender) {
|
||||
sender = setTimeout(() => {
|
||||
sender = queueMicrotask(() => {
|
||||
socket.send(Buffer.concat(buffer, length));
|
||||
buffer = [];
|
||||
sender = null;
|
||||
|
||||
Reference in New Issue
Block a user