| 26 | } |
| 27 | |
| 28 | class Consumer extends events.EventEmitter { |
| 29 | emitter: any; |
| 30 | |
| 31 | constructor(emitter: any) { |
| 32 | super(); |
| 33 | this.emitter = emitter; |
| 34 | } |
| 35 | |
| 36 | subscribe(channel: string): void { |
| 37 | unsubscribe(channel); |
| 38 | const handler = message => { |
| 39 | this.emit('message', channel, message); |
| 40 | }; |
| 41 | subscriptions.set(channel, handler); |
| 42 | this.emitter.on(channel, handler); |
| 43 | } |
| 44 | |
| 45 | unsubscribe(channel: string): void { |
| 46 | unsubscribe(channel); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | function createPublisher(): any { |
| 51 | return new Publisher(emitter); |
nothing calls this directly
no outgoing calls
no test coverage detected