File size: 768 Bytes
1a7b22d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Browser API support detection utilities
 * Centralized support checking to avoid duplication across modules
 */

import type { Serial, USB } from "../types/port-discovery.js";

declare global {
  interface Navigator {
    serial: Serial;
    usb: USB;
  }
}

/**
 * Check if Web Serial API is available in the current browser
 * @returns true if Web Serial is supported, false otherwise
 */
export function isWebSerialSupported(): boolean {
  return "serial" in navigator && typeof navigator.serial !== "undefined";
}

/**
 * Check if WebUSB API is available in the current browser
 * @returns true if WebUSB is supported, false otherwise
 */
export function isWebUSBSupported(): boolean {
  return "usb" in navigator && typeof navigator.usb !== "undefined";
}