MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / emitOnce

Method emitOnce

cli/src/api/messageEmitter.ts:6–13  ·  view source on GitHub ↗
(message: string, emit: (message: string) => void)

Source from the content-addressed store, hash-verified

4 private readonly seenMessageKeys = new Set<string>();
5
6 emitOnce(message: string, emit: (message: string) => void): void {
7 const key = messageKey(message);
8 if (this.seenMessageKeys.has(key)) {
9 return;
10 }
11 this.seenMessageKeys.add(key);
12 emit(message);
13 }
14}
15
16function messageKey(message: string): string {

Calls 1

messageKeyFunction · 0.85

Tested by

no test coverage detected