()
| 259 | } |
| 260 | |
| 261 | [SymbolAsyncIterator]() { |
| 262 | const { signal } = this.#options; |
| 263 | const promiseExecutor = signal == null ? |
| 264 | (resolve) => { |
| 265 | this.once('change', (eventType, filename) => { |
| 266 | resolve({ __proto__: null, value: { eventType, filename } }); |
| 267 | }); |
| 268 | } : (resolve, reject) => { |
| 269 | const onAbort = () => { |
| 270 | this.close(); |
| 271 | reject(new AbortError(undefined, { cause: signal.reason })); |
| 272 | }; |
| 273 | if (signal.aborted) return onAbort(); |
| 274 | kResistStopPropagation ??= require('internal/event_target').kResistStopPropagation; |
| 275 | signal.addEventListener('abort', onAbort, { __proto__: null, once: true, [kResistStopPropagation]: true }); |
| 276 | this.once('change', (eventType, filename) => { |
| 277 | signal.removeEventListener('abort', onAbort); |
| 278 | resolve({ __proto__: null, value: { eventType, filename } }); |
| 279 | }); |
| 280 | }; |
| 281 | return { |
| 282 | next: () => (this.#closed ? |
| 283 | { __proto__: null, done: true } : |
| 284 | new Promise(promiseExecutor)), |
| 285 | return: () => { |
| 286 | this.close(); |
| 287 | return { __proto__: null, done: true }; |
| 288 | }, |
| 289 | [SymbolAsyncIterator]() { return this; }, |
| 290 | }; |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | module.exports = { |
nothing calls this directly
no test coverage detected