* Handle file changes with debouncing to prevent excessive updates
(file: TFile, cache: unknown)
| 143 | * Handle file changes with debouncing to prevent excessive updates |
| 144 | */ |
| 145 | private handleFileChangedDebounced(file: TFile, cache: unknown): void { |
| 146 | const path = file.path; |
| 147 | |
| 148 | // Cancel existing debounced handler for this file |
| 149 | const existingTimeout = this.debouncedHandlers.get(path); |
| 150 | if (existingTimeout) { |
| 151 | window.clearTimeout(existingTimeout); |
| 152 | } |
| 153 | |
| 154 | // Schedule new handler |
| 155 | const timeoutId = window.setTimeout(() => { |
| 156 | this.debouncedHandlers.delete(path); |
| 157 | void this.handleFileChanged(file, cache); |
| 158 | }, this.DEBOUNCE_DELAY); |
| 159 | |
| 160 | this.debouncedHandlers.set(path, timeoutId); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Handle file change - emit events for listeners |
no test coverage detected