* Polls for changes.
()
| 128 | * Polls for changes. |
| 129 | */ |
| 130 | #poll() { |
| 131 | if (this.#closed) return; |
| 132 | |
| 133 | // For directory watching, poll tracked children |
| 134 | if (this.#lastStats?.isDirectory()) { |
| 135 | this.#pollDirectory(); |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | // For single file watching |
| 140 | const newStats = this.#getStats(); |
| 141 | |
| 142 | if (this.#statsChanged(this.#lastStats, newStats)) { |
| 143 | const eventType = this.#determineEventType(this.#lastStats, newStats); |
| 144 | const filename = this.#encodeFilename(basename(this.#path)); |
| 145 | this.emit('change', eventType, filename); |
| 146 | } |
| 147 | |
| 148 | this.#lastStats = newStats; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Polls directory children for changes, detecting new and deleted files. |
no test coverage detected