diff --git a/packages/interface-compliance-tests/src/transport/listen-test.ts b/packages/interface-compliance-tests/src/transport/listen-test.ts index 4f18a2ecde..ddc585506d 100644 --- a/packages/interface-compliance-tests/src/transport/listen-test.ts +++ b/packages/interface-compliance-tests/src/transport/listen-test.ts @@ -1,5 +1,5 @@ /* eslint max-nested-callbacks: ["error", 8] */ -import { CustomEvent, TypedEventEmitter } from '@libp2p/interface' +import { TypedEventEmitter } from '@libp2p/interface' import { expect } from 'aegir/chai' import drain from 'it-drain' import { pipe } from 'it-pipe' diff --git a/packages/interface/src/event-target.ts b/packages/interface/src/event-target.ts index de967c61ff..1771f42995 100644 --- a/packages/interface/src/event-target.ts +++ b/packages/interface/src/event-target.ts @@ -104,5 +104,3 @@ export class TypedEventEmitter> extends Eve return this.dispatchEvent(new CustomEvent(type as string, detail)) } } - -export const CustomEvent = globalThis.CustomEvent diff --git a/packages/kad-dht/src/kad-dht.ts b/packages/kad-dht/src/kad-dht.ts index e6371d6db8..b5063d32e2 100644 --- a/packages/kad-dht/src/kad-dht.ts +++ b/packages/kad-dht/src/kad-dht.ts @@ -1,4 +1,4 @@ -import { CodeError, CustomEvent, TypedEventEmitter, contentRoutingSymbol, peerDiscoverySymbol, peerRoutingSymbol, serviceCapabilities, serviceDependencies, start, stop } from '@libp2p/interface' +import { CodeError, TypedEventEmitter, contentRoutingSymbol, peerDiscoverySymbol, peerRoutingSymbol, serviceCapabilities, serviceDependencies, start, stop } from '@libp2p/interface' import drain from 'it-drain' import pDefer from 'p-defer' import { PROTOCOL } from './constants.js' diff --git a/packages/kad-dht/src/query/events.ts b/packages/kad-dht/src/query/events.ts index b1fe332d7c..548bcf75fc 100644 --- a/packages/kad-dht/src/query/events.ts +++ b/packages/kad-dht/src/query/events.ts @@ -1,4 +1,3 @@ -import { CustomEvent } from '@libp2p/interface' import type { MessageType, SendQueryEvent, PeerResponseEvent, DialPeerEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent } from '../index.js' import type { PeerId, PeerInfo } from '@libp2p/interface' import type { Libp2pRecord } from '@libp2p/record' diff --git a/packages/kad-dht/src/topology-listener.ts b/packages/kad-dht/src/topology-listener.ts index 2b24b3417b..a707298e87 100644 --- a/packages/kad-dht/src/topology-listener.ts +++ b/packages/kad-dht/src/topology-listener.ts @@ -1,4 +1,4 @@ -import { CustomEvent, TypedEventEmitter } from '@libp2p/interface' +import { TypedEventEmitter } from '@libp2p/interface' import type { KadDHTComponents } from '.' import type { Logger, PeerId, Startable } from '@libp2p/interface' diff --git a/packages/kad-dht/test/query-self.spec.ts b/packages/kad-dht/test/query-self.spec.ts index 0520a4e7b7..80863dc858 100644 --- a/packages/kad-dht/test/query-self.spec.ts +++ b/packages/kad-dht/test/query-self.spec.ts @@ -1,6 +1,5 @@ /* eslint-env mocha */ -import { CustomEvent } from '@libp2p/interface' import { defaultLogger } from '@libp2p/logger' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' diff --git a/packages/kad-dht/test/routing-table.spec.ts b/packages/kad-dht/test/routing-table.spec.ts index 51b27a1dd7..49f0ee3463 100644 --- a/packages/kad-dht/test/routing-table.spec.ts +++ b/packages/kad-dht/test/routing-table.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { TypedEventEmitter, CustomEvent, stop, start } from '@libp2p/interface' +import { TypedEventEmitter, stop, start } from '@libp2p/interface' import { mockConnectionManager } from '@libp2p/interface-compliance-tests/mocks' import { defaultLogger } from '@libp2p/logger' import { PeerSet } from '@libp2p/peer-collections' diff --git a/packages/libp2p/src/libp2p.ts b/packages/libp2p/src/libp2p.ts index af6981f091..de11a09fff 100644 --- a/packages/libp2p/src/libp2p.ts +++ b/packages/libp2p/src/libp2p.ts @@ -1,5 +1,5 @@ import { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys' -import { contentRoutingSymbol, CodeError, TypedEventEmitter, CustomEvent, setMaxListeners, peerDiscoverySymbol, peerRoutingSymbol } from '@libp2p/interface' +import { contentRoutingSymbol, CodeError, TypedEventEmitter, setMaxListeners, peerDiscoverySymbol, peerRoutingSymbol } from '@libp2p/interface' import { defaultLogger } from '@libp2p/logger' import { PeerSet } from '@libp2p/peer-collections' import { peerIdFromString } from '@libp2p/peer-id' diff --git a/packages/peer-discovery-mdns/src/mdns.ts b/packages/peer-discovery-mdns/src/mdns.ts index a7a56e4f80..db4444bf29 100644 --- a/packages/peer-discovery-mdns/src/mdns.ts +++ b/packages/peer-discovery-mdns/src/mdns.ts @@ -1,4 +1,4 @@ -import { CustomEvent, TypedEventEmitter, peerDiscoverySymbol, serviceCapabilities } from '@libp2p/interface' +import { TypedEventEmitter, peerDiscoverySymbol, serviceCapabilities } from '@libp2p/interface' import multicastDNS from 'multicast-dns' import * as query from './query.js' import { stringGen } from './utils.js' diff --git a/packages/peer-discovery-mdns/test/compliance.spec.ts b/packages/peer-discovery-mdns/test/compliance.spec.ts index 6c9e3ee5af..b6b8b81f27 100644 --- a/packages/peer-discovery-mdns/test/compliance.spec.ts +++ b/packages/peer-discovery-mdns/test/compliance.spec.ts @@ -1,6 +1,5 @@ /* eslint-env mocha */ -import { CustomEvent } from '@libp2p/interface' import tests from '@libp2p/interface-compliance-tests/peer-discovery' import { defaultLogger } from '@libp2p/logger' import { createEd25519PeerId } from '@libp2p/peer-id-factory' diff --git a/packages/pubsub/src/index.ts b/packages/pubsub/src/index.ts index 6afa9a07e5..536f3fc206 100644 --- a/packages/pubsub/src/index.ts +++ b/packages/pubsub/src/index.ts @@ -30,7 +30,7 @@ * ``` */ -import { CodeError, TypedEventEmitter, CustomEvent, TopicValidatorResult } from '@libp2p/interface' +import { CodeError, TypedEventEmitter, TopicValidatorResult } from '@libp2p/interface' import { PeerMap, PeerSet } from '@libp2p/peer-collections' import { pipe } from 'it-pipe' import Queue from 'p-queue' diff --git a/packages/pubsub/src/peer-streams.ts b/packages/pubsub/src/peer-streams.ts index d9cd9cfa9c..3dfb15515f 100644 --- a/packages/pubsub/src/peer-streams.ts +++ b/packages/pubsub/src/peer-streams.ts @@ -1,4 +1,4 @@ -import { TypedEventEmitter, CustomEvent } from '@libp2p/interface' +import { TypedEventEmitter } from '@libp2p/interface' import { closeSource } from '@libp2p/utils/close-source' import * as lp from 'it-length-prefixed' import { pipe } from 'it-pipe'