Skip to content

Commit

Permalink
removing that event was easier than expected
Browse files Browse the repository at this point in the history
  • Loading branch information
pvh committed Jul 24, 2024
1 parent 1c337ba commit 623b128
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions packages/automerge-repo/src/network/NetworkSubsystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ export class NetworkSubsystem extends EventEmitter<NetworkSubsystemEvents> {

addNetworkAdapter(networkAdapter: NetworkAdapterInterface) {
this.adapters.push(networkAdapter)
void networkAdapter.whenReady().then(() => {
if (this.adapters.every(a => a.isReady())) {
this.emit("ready")
}
})

networkAdapter.on("peer-candidate", ({ peerId, peerMetadata }) => {
this.#log(`peer candidate: ${peerId} `)
Expand Down Expand Up @@ -181,7 +176,6 @@ export interface NetworkSubsystemEvents {
peer: (payload: PeerPayload) => void
"peer-disconnected": (payload: PeerDisconnectedPayload) => void
message: (payload: RepoMessage) => void
ready: () => void
}

export interface PeerPayload {
Expand Down
4 changes: 2 additions & 2 deletions packages/automerge-repo/test/remoteHeads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ async function connectRepos(a: Repo, b: Repo) {
a.networkSubsystem.addNetworkAdapter(aAdapter)
b.networkSubsystem.addNetworkAdapter(bAdapter)
await Promise.all([
eventPromise(a.networkSubsystem, "ready"),
eventPromise(b.networkSubsystem, "ready"),
a.networkSubsystem.whenReady(),
a.networkSubsystem.whenReady(),
])
}

0 comments on commit 623b128

Please sign in to comment.