chore: fix review comments

This commit is contained in:
Simon Chan 2025-09-09 23:37:06 +08:00
parent 4e2fcb83ba
commit cf276c5b9c
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
4 changed files with 3 additions and 15 deletions

View file

@ -143,16 +143,6 @@ export class AdbDaemonWebUsbConnection
new MaybeConsumable.WritableStream({ new MaybeConsumable.WritableStream({
write: async (chunk) => { write: async (chunk) => {
try { try {
if (
typeof SharedArrayBuffer !== "undefined" &&
chunk.buffer instanceof SharedArrayBuffer
) {
// Copy data to a non-shared ArrayBuffer
const copy = new Uint8Array(chunk.byteLength);
copy.set(chunk);
chunk = copy;
}
await device.raw.transferOut( await device.raw.transferOut(
outEndpoint.endpointNumber, outEndpoint.endpointNumber,
// WebUSB doesn't support SharedArrayBuffer // WebUSB doesn't support SharedArrayBuffer

View file

@ -27,7 +27,7 @@ export class AdbScrcpyOptions3_3_2<TVideo extends boolean>
) { ) {
super(init); super(init);
this.version = clientOptions?.version ?? "3.3.1"; this.version = clientOptions?.version ?? "3.3.2";
this.spawner = clientOptions?.spawner; this.spawner = clientOptions?.spawner;
} }

View file

@ -3,7 +3,5 @@ export function toLocalUint8Array(value: Uint8Array): Uint8Array<ArrayBuffer> {
return value as Uint8Array<ArrayBuffer>; return value as Uint8Array<ArrayBuffer>;
} }
const copy = new Uint8Array(value.length); return new Uint8Array(value);
copy.set(value);
return copy;
} }

View file

@ -1,6 +1,6 @@
import * as ScrcpyControlMessageType from "./control-message-type-value.js"; import * as ScrcpyControlMessageType from "./control-message-type-value.js";
// These IDs change between versions, so always use `options.getControlMessageTypes()` // These IDs change between versions, so always use `options.controlMessageTypes`
// biome-ignore lint/suspicious/noRedeclare: TypeScript declaration merging for enum-like object // biome-ignore lint/suspicious/noRedeclare: TypeScript declaration merging for enum-like object
type ScrcpyControlMessageType = type ScrcpyControlMessageType =
(typeof ScrcpyControlMessageType)[keyof typeof ScrcpyControlMessageType]; (typeof ScrcpyControlMessageType)[keyof typeof ScrcpyControlMessageType];