vor ble umbau
This commit is contained in:
24
webpage/src/lib/init.ts
Normal file
24
webpage/src/lib/init.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// src/lib/init.ts
|
||||
import { isBluetoothSupported, isSerialSupported, isInitializing } from './store';
|
||||
|
||||
export function getBrowserName(): string {
|
||||
const ua = navigator.userAgent;
|
||||
if (ua.includes("Firefox")) return "Feuerfuchs";
|
||||
if (ua.includes("Safari") && !ua.includes("Chrome")) return "Apfel-Rundreise";
|
||||
if (ua.includes("Edg")) return "Winzigweich Kante";
|
||||
if (ua.includes("Chrome")) return "Google Glanzeisen";
|
||||
return "dein Browser";
|
||||
}
|
||||
|
||||
export function performHardwareCheck() {
|
||||
if (typeof navigator === 'undefined') return;
|
||||
|
||||
// Web Bluetooth Check
|
||||
const hasBT = 'bluetooth' in navigator;
|
||||
// Web Serial Check
|
||||
const hasSerial = 'serial' in navigator;
|
||||
|
||||
isBluetoothSupported.set(hasBT);
|
||||
isSerialSupported.set(hasSerial);
|
||||
isInitializing.set(false);
|
||||
}
|
||||
Reference in New Issue
Block a user