()
| 2431 | if (this[kDestroyed]) { |
| 2432 | if (this[kOnDestroyed]) { |
| 2433 | this[kOnDestroyed].push(callback); |
| 2434 | } else { |
| 2435 | queueMicrotask(() => callback(null, null)); |
| 2436 | } |
| 2437 | return; |
| 2438 | } |
| 2439 | if (!err) { |
| 2440 | err = new ClientDestroyedError(); |
| 2441 | } |
| 2442 | this[kDestroyed] = true; |
| 2443 | this[kOnDestroyed] = this[kOnDestroyed] || []; |
| 2444 | this[kOnDestroyed].push(callback); |
| 2445 | const onDestroyed = () => { |
| 2446 | const callbacks = this[kOnDestroyed]; |
| 2447 | this[kOnDestroyed] = null; |
| 2448 | for (let i = 0; i < callbacks.length; i++) { |
| 2449 | callbacks[i](null, null); |
| 2450 | } |
| 2451 | }; |
| 2452 | this[kDestroy](err).then(() => { |
| 2453 | queueMicrotask(onDestroyed); |
| 2454 | }); |
| 2455 | } |
| 2456 | [kInterceptedDispatch](opts, handler) { |
| 2457 | if (!this[kInterceptors] || this[kInterceptors].length === 0) { |
| 2458 | this[kInterceptedDispatch] = this[kDispatch]; |
| 2459 | return this[kDispatch](opts, handler); |
| 2460 | } |
| 2461 | let dispatch = this[kDispatch].bind(this); |
| 2462 | for (let i = this[kInterceptors].length - 1; i >= 0; i--) { |
| 2463 | dispatch = this[kInterceptors][i](dispatch); |
no test coverage detected