()
| 1 | // 性能优化模块 |
| 2 | class PerformanceOptimizer { |
| 3 | constructor() { |
| 4 | this.isOnline = navigator.onLine; |
| 5 | this.observers = new Map(); // Track observers for cleanup |
| 6 | this._webpSupported = null; // 缓存 WebP 检测结果 |
| 7 | this._parallaxElements = null; // 缓存视差元素查询 |
| 8 | this.init(); |
| 9 | } |
| 10 | |
| 11 | init() { |
| 12 | this.setupNetworkListeners(); |