Skip to content

Commit

Permalink
feat: apply improvment from deno
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Dec 1, 2023
1 parent 6e3dfe4 commit eb5d2d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
},
"devDependencies": {
"@types/node": "^14.*",
"@types/ws": "^8.5.9",
"@types/ws": "^8.5.10",
"del-cli": "^5.1.0",
"discord-api-types": "^0.37.63"
"discord-api-types": "^0.37.65"
},
"engines": {
"node": ">=14.18.0"
Expand Down
13 changes: 2 additions & 11 deletions src/transport/IPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,7 @@ export class IPCTransport extends Transport {
);

this.socket.on("readable", () => {
let data = this.socket?.read() as Buffer | undefined;
if (!data) return;
this.client.emit(
"debug",
`SERVER => CLIENT | ${data
.toString("hex")
.match(/.{1,2}/g)
?.join(" ")
.toUpperCase()}`
);
let data = Buffer.alloc(0);

do {
const chunk = this.socket?.read() as Buffer | undefined;
Expand Down Expand Up @@ -227,7 +218,7 @@ export class IPCTransport extends Transport {
}

close(): Promise<void> {
if (!this.socket) return new Promise((resolve) => void resolve());
if (!this.socket) return Promise.resolve();

return new Promise((resolve) => {
this.socket!.once("close", () => {
Expand Down

0 comments on commit eb5d2d2

Please sign in to comment.