mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 10:23:41 +00:00
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>
17 lines
506 B
TypeScript
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;
|
|
}
|