feat: android support

This commit is contained in:
2024-11-23 15:01:14 +01:00
parent f3704e4051
commit 6a0dad9dad
3 changed files with 16 additions and 0 deletions

View File

@@ -37,6 +37,13 @@ if (
await import("./tauri-serial");
}
if (browser && navigator.serial === undefined && navigator.usb !== undefined) {
// @ts-expect-error polyfill
navigator.serial = await import("web-serial-polyfill").then(
({ serial }) => serial,
);
}
export async function getViablePorts(): Promise<SerialPort[]> {
return navigator.serial.getPorts().then((ports) =>
ports.filter((it) => {