Fix ESLint warnings (and one actual bug)

This commit is contained in:
Joshua Bell 2023-01-04 19:34:23 -08:00
parent 8efe1058f8
commit 0242c645ca
1 changed files with 7 additions and 5 deletions

View File

@ -421,7 +421,7 @@ async function getSerialPort() {
if (n <= 0) throw new Error(); if (n <= 0) throw new Error();
const result = []; const result = [];
while (result.length < n) { 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'); if (done) throw new Error('out of data');
result.push(value); result.push(value);
} }
@ -463,7 +463,7 @@ async function startStreaming() {
}; };
while (true) { for (;;) {
const command = (await port.read(1))[0]; const command = (await port.read(1))[0];
const size = (await port.read(1))[0]; const size = (await port.read(1))[0];
const data = size ? await port.read(size) : []; const data = size ? await port.read(size) : [];
@ -491,9 +491,11 @@ async function startStreaming() {
// Screen // Screen
case 0x80: case 0x80:
// Send a copy // Send a copy
let copy = new Uint8Array(hires_buffer); {
await port.write(copy); let copy = new Uint8Array(hires_buffer);
break; await port.write(copy);
break;
}
default: default:
console.warn(`Unexpected protocol command: ${command}`); console.warn(`Unexpected protocol command: ${command}`);