respira/src/utils/bluetoothSupport.ts
Jan-Henrik Bruhn 5fea462a71 feature: Add browser compatibility detection for Web Bluetooth
Detects if the browser supports Web Bluetooth API and displays an
informative warning when unsupported. Provides users with clear
options: use a compatible browser or download the desktop app.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-16 23:54:55 +01:00

17 lines
506 B
TypeScript

/**
* Check if the current browser/environment supports Web Bluetooth API
* @returns true if Web Bluetooth is supported (or running in Electron), false otherwise
*/
export function isBluetoothSupported(): boolean {
// Always supported in Electron app
if (typeof window !== "undefined" && "electronAPI" in window) {
return true;
}
// Check for Web Bluetooth API support in browser
if (typeof navigator !== "undefined" && "bluetooth" in navigator) {
return true;
}
return false;
}