Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up eventEmitter stuff #458

Open
acolytec3 opened this issue Sep 11, 2023 · 0 comments
Open

Clean up eventEmitter stuff #458

acolytec3 opened this issue Sep 11, 2023 · 0 comments

Comments

@acolytec3
Copy link
Collaborator

Thinking through our eventEmitter garbage. We have at least 3 distinct eventEmitters inside of portalnetwork and we should really consider either putting these all on a central event bus or at least making them all StrictEventEmitters. They are:

  1. portalnetwork class - this is a StrictEventEmitter with typed events (including an unused ContentAdded event
  2. protocol base class - each subprotocol is a bare eventEmitter that currently only emits a ContentAdded event (used widely for gossip and resolving sendFindContent calls among other things
  3. uTP looks like it has multiple event emitters inside it. I'm less concerned about these as they are contained within uTP which the rest of the portal network class should treat as a black box (not entirely successfully but still, it's a worthy goal)

So, at a minimum, let's do the following:

  1. Remove the ContentAdded event from the IPortalNetworkEvents interface
  2. Switch the protocol classes's EventEmitter to the StrictEventEmitter type and create an interface for the ContentAdded event
  3. Make the uTP event emitters StrictEventEmitter with typed events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant