From 510e0a108d8059ee7907a642a8eb9fb11dc7a069 Mon Sep 17 00:00:00 2001 From: Egor Aristov Date: Sun, 16 Nov 2025 09:23:46 +0300 Subject: [PATCH] refactor --- lib/ts/src/lib.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/ts/src/lib.ts b/lib/ts/src/lib.ts index b0ce809..8d49ad1 100644 --- a/lib/ts/src/lib.ts +++ b/lib/ts/src/lib.ts @@ -169,17 +169,6 @@ abstract class IPCCommon { callback({result: msg.result || [], error: err}); } - stop() { - if (this.stopRequested) { - throw new Error('close already requested'); - } - if (!this.conn || this.conn.readyState === 'closed') { - throw new Error('connection already closed'); - } - this.stopRequested = true; - if (this.onClose) this.onClose(); - } - call(method: string, ...params: Vals): Promise { return new Promise((resolve, reject) => { const id = this.nextId++; @@ -200,6 +189,17 @@ abstract class IPCCommon { }); } + stop() { + if (this.stopRequested) { + throw new Error('close already requested'); + } + if (!this.conn || this.conn.readyState === 'closed') { + throw new Error('connection already closed'); + } + this.stopRequested = true; + if (this.onClose) this.onClose(); + } + protected raiseErr(err: Error): void { this.errorQueue.put(err); }