From 0242c645caf765cca4d62cd19ced56df49ecc0fc Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 4 Jan 2023 19:34:23 -0800 Subject: [PATCH] Fix ESLint warnings (and one actual bug) --- server.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index b8474c2..27d03b9 100644 --- a/server.js +++ b/server.js @@ -421,7 +421,7 @@ async function getSerialPort() { if (n <= 0) throw new Error(); const result = []; while (result.length < n) { - const {value, done} = await gen.next(); + const {value, done} = await this.gen.next(); if (done) throw new Error('out of data'); result.push(value); } @@ -463,7 +463,7 @@ async function startStreaming() { }; - while (true) { + for (;;) { const command = (await port.read(1))[0]; const size = (await port.read(1))[0]; const data = size ? await port.read(size) : []; @@ -491,9 +491,11 @@ async function startStreaming() { // Screen case 0x80: // Send a copy - let copy = new Uint8Array(hires_buffer); - await port.write(copy); - break; + { + let copy = new Uint8Array(hires_buffer); + await port.write(copy); + break; + } default: console.warn(`Unexpected protocol command: ${command}`);