Reformat client.ts

This commit is contained in:
Dojo Coder
2024-09-26 14:37:06 +02:00
parent 4859ffbe08
commit b358799033

View File

@@ -1,14 +1,14 @@
import { EventEmitter } from "node:events";
import net from "node:net";
import tls from "node:tls";
import { EventEmitter } from "node:events";
import * as util from "./util.js";
import type {
Protocol,
Callbacks,
ElectrumRequestBatchParams,
ElectrumRequestParams,
Protocol,
} from "../types";
import * as util from "./util.js";
const TIMEOUT = 60000;
@@ -86,13 +86,13 @@ export abstract class Client {
if (this.conn && this.conn.readyState === "open") {
resolve();
}
this.protocol === "tcp"
? this.conn?.once("connect", () => {
resolve();
})
: this.conn?.once("secureConnect", () => {
resolve();
});
this.conn?.once(
this.protocol === "tcp" ? "connect" : "secureConnect",
() => {
resolve();
},
);
});
}