* Closes the watcher and stops polling.
()
| 335 | * Closes the watcher and stops polling. |
| 336 | */ |
| 337 | close() { |
| 338 | if (this.#closed) return; |
| 339 | this.#closed = true; |
| 340 | |
| 341 | if (this.#timer) { |
| 342 | clearInterval(this.#timer); |
| 343 | this.#timer = null; |
| 344 | } |
| 345 | |
| 346 | // Clear tracked files |
| 347 | this.#trackedFiles.clear(); |
| 348 | |
| 349 | // Remove abort handler |
| 350 | if (this.#signal && this.#abortHandler) { |
| 351 | this.#signal.removeEventListener('abort', this.#abortHandler); |
| 352 | } |
| 353 | |
| 354 | this.emit('close'); |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * Alias for close() - compatibility with FSWatcher. |
no test coverage detected