fix: change on to always return an instance of emittery unsubscribe function
This commit is contained in:
parent
5691c7a488
commit
0c18c92521
|
@ -188,10 +188,10 @@ export class Socket extends Client {
|
||||||
await this.swarm.emit("setup", this);
|
await this.swarm.emit("setup", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
on(event: any, listener: any) {
|
||||||
on(event: any, listener: any): this {
|
const parentOn = super.on(event, listener);
|
||||||
if (this.eventUpdates[event]?.has(listener)) {
|
if (this.eventUpdates[event]?.has(listener)) {
|
||||||
return this;
|
return parentOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [update, promise] = this.connectModule(
|
const [update, promise] = this.connectModule(
|
||||||
|
@ -207,8 +207,7 @@ export class Socket extends Client {
|
||||||
this.off(event as string, listener);
|
this.off(event as string, listener);
|
||||||
});
|
});
|
||||||
|
|
||||||
super.on(event, listener);
|
return parentOn;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
off(event: any, listener: any): this {
|
off(event: any, listener: any): this {
|
||||||
|
|
Loading…
Reference in New Issue