Skip to content

Commit

Permalink
fix!: remove event emitter type from interfaces (libp2p#2196)
Browse files Browse the repository at this point in the history
All code should be using `TypedEventEmitter` instead of `EventEmitter`
so remove the re-export from the interfaces package.

BREAKING CHANGE: removed EventEmitter re-export - please use TypedEventEmitter instead
  • Loading branch information
achingbrain authored and maschad committed Nov 27, 2023
1 parent ecc2fd0 commit 2cb85e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/interface/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class CustomEventPolyfill<T = any> extends Event {

export const CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill

// TODO: remove this in v1
export { TypedEventEmitter as EventEmitter }

// create a setMaxListeners that doesn't break browser usage
export const setMaxListeners: typeof nodeSetMaxListeners = (n, ...eventTargets) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/peer-discovery-mdns/src/mdns.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomEvent, EventEmitter } from '@libp2p/interface/events'
import { CustomEvent, TypedEventEmitter } from '@libp2p/interface/events'
import { peerDiscovery } from '@libp2p/interface/peer-discovery'
import multicastDNS from 'multicast-dns'
import * as query from './query.js'
Expand All @@ -23,7 +23,7 @@ export interface MulticastDNSComponents {
logger: ComponentLogger
}

export class MulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscovery, Startable {
export class MulticastDNS extends TypedEventEmitter<PeerDiscoveryEvents> implements PeerDiscovery, Startable {
public mdns?: multicastDNS.MulticastDNS

private readonly log: Logger
Expand Down

0 comments on commit 2cb85e5

Please sign in to comment.