UNPKG

awake-lock

Version:

A comprehensive wake lock library for preventing device sleep with intelligent fallback strategies and exceptional performance

42 lines 1.5 kB
import { PerformanceMetrics, WakeLockEvents } from './types'; import { EventEmitter } from './utils/EventEmitter'; export declare class PerformanceMonitor extends EventEmitter<WakeLockEvents> { private readonly enabled; private readonly monitoringInterval; private readonly batteryThreshold; private readonly performanceThreshold; private monitoringTimer; private battery; private lastMetrics; private isMonitoring; private readonly throttledEmitPerformance; constructor(options?: { enabled?: boolean; monitoringInterval?: number; batteryThreshold?: number; performanceThreshold?: number; }); start(): Promise<void>; stop(): void; getCurrentMetrics(): Promise<PerformanceMetrics>; getLastMetrics(): PerformanceMetrics | null; isLowBattery(): boolean; isHighCpuUsage(): boolean; shouldOptimizePerformance(): boolean; private initializeBatteryMonitoring; private startPerformanceMonitoring; private collectMetrics; private estimateCpuUsage; private estimateBatteryDrain; private handleLowBattery; private handlePerformanceOptimization; getOptimizationRecommendations(): string[]; measureStrategy(strategyName: string, operation: () => Promise<void>): Promise<{ duration: number; cpuBefore: number; cpuAfter: number; memoryBefore: number; memoryAfter: number; }>; } //# sourceMappingURL=PerformanceMonitor.d.ts.map