refactor
This commit is contained in:
parent
7f0d7047e9
commit
510e0a108d
@ -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<Vals> {
|
||||
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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user