fix: change on to always return an instance of emittery unsubscribe function

This commit is contained in:
Derrick Hammer 2023-07-22 06:03:44 -04:00
parent 5691c7a488
commit 0c18c92521
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 5 deletions

View File

@ -188,10 +188,10 @@ export class Socket extends Client {
await this.swarm.emit("setup", this);
}
// @ts-ignore
on(event: any, listener: any): this {
on(event: any, listener: any) {
const parentOn = super.on(event, listener);
if (this.eventUpdates[event]?.has(listener)) {
return this;
return parentOn;
}
const [update, promise] = this.connectModule(
@ -207,8 +207,7 @@ export class Socket extends Client {
this.off(event as string, listener);
});
super.on(event, listener);
return this;
return parentOn;
}
off(event: any, listener: any): this {