(options)
| 20 | #onError; |
| 21 | #timer; |
| 22 | constructor(options) { |
| 23 | this.#udp = new UDP({ |
| 24 | target: this, |
| 25 | onReadable: this.#onReadable |
| 26 | }); |
| 27 | |
| 28 | this.#onTime = options.onTime; |
| 29 | if (!this.#onTime) |
| 30 | throw new Error("onTime required"); |
| 31 | |
| 32 | this.#onError = options.onError; |
| 33 | |
| 34 | System.resolve(options.host, (name, address) => { |
| 35 | if (!address) { |
| 36 | this.#onError?.(); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | request.call(this.#udp, address); |
| 41 | this.#timer = System.setInterval(() => request.call(this.#udp, address), 5 * 1000); |
| 42 | }); |
| 43 | } |
| 44 | close() { |
| 45 | if (this.#timer) |
| 46 | System.clearInterval(this.#timer); |
nothing calls this directly
no test coverage detected