export class NetworkMonitor { static async checkNetworkQuality(): Promise { // 简单的网络质量检测 const startTime = performance.now() try { const response = await fetch('/api/health-check', { method: 'HEAD', cache: 'no-cache' }) const endTime = performance.now() return endTime - startTime } catch (error) { return -1 } } static getNetworkInfo() { const connection = (navigator as any).connection return connection ? { effectiveType: connection.effectiveType, downlink: connection.downlink, rtt: connection.rtt, saveData: connection.saveData } : null } static isOnline(): boolean { return navigator.onLine } }