Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
balazskreith committed Oct 10, 2024
1 parent acb5adc commit 1e20ec8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/collections/HamokEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,14 @@ export class HamokEmitter<T extends HamokEmitterEventMap, M extends Record<strin
serializedMetaData = 'null';
}
} else serializedMetaData = 'null';

await this.connection.requestInsertEntries(new Map([ [ event as string, serializedMetaData ] ]));

this._emitter.on(event as string, listener);
try {
await this.connection.requestInsertEntries(new Map([ [ event as string, serializedMetaData ] ]));
} catch (err) {
this._emitter.off(event as string, listener);
throw err;
}
}

public async updateSubscriptionMetaData<K extends keyof T>(event: K, newMetaData: M, prevMetaData?: M | null): Promise<boolean> {
Expand Down

0 comments on commit 1e20ec8

Please sign in to comment.