-
Couldn't load subscription status.
- Fork 837
Switch events to eventemitter3 - the saga #3746
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
Changes from 13 commits
a4136b7
fa9a212
ac961e1
8a4fdcb
c2c85c5
5d8d1b9
22ef3a0
2bac53d
3eb9bef
b6f3d4f
71100b4
be6c4ac
fe77784
b957c81
b03777f
4794aa4
39a7b63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| import { EventEmitter } from 'events' | ||
|
|
||
| import type { SyncMode } from './index.js' | ||
| import type { Peer } from './net/peer/index.js' | ||
| import type { Server } from './net/server/index.js' | ||
|
|
@@ -56,33 +54,6 @@ export interface EventParams { | |
| [Event.PROTOCOL_MESSAGE]: [messageDetails: any, protocolName: string, sendingPeer: Peer] | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does the deletion of this event bus change the typing of the client types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| export declare interface EventBus<T extends Event> { | ||
| emit(event: T, ...args: EventParams[T]): boolean | ||
| on(event: T, listener: (...args: EventParams[T]) => void): this | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| export class EventBus<T extends Event> extends EventEmitter {} | ||
| export type EventBusType = EventBus<Event.CHAIN_UPDATED> & | ||
| EventBus<Event.CLIENT_SHUTDOWN> & | ||
| EventBus<Event.SYNC_EXECUTION_VM_ERROR> & | ||
| EventBus<Event.SYNC_FETCHED_BLOCKS> & | ||
| EventBus<Event.SYNC_FETCHED_HEADERS> & | ||
| EventBus<Event.SYNC_SYNCHRONIZED> & | ||
| EventBus<Event.SYNC_SNAPSYNC_COMPLETE> & | ||
| EventBus<Event.SYNC_FETCHER_ERROR> & | ||
| EventBus<Event.PEER_CONNECTED> & | ||
| EventBus<Event.PEER_DISCONNECTED> & | ||
| EventBus<Event.PEER_ERROR> & | ||
| EventBus<Event.SERVER_LISTENING> & | ||
| EventBus<Event.SERVER_ERROR> & | ||
| EventBus<Event.SYNC_ERROR> & | ||
| EventBus<Event.POOL_PEER_ADDED> & | ||
| EventBus<Event.POOL_PEER_REMOVED> & | ||
| EventBus<Event.POOL_PEER_BANNED> & | ||
| EventBus<Event.PROTOCOL_ERROR> & | ||
| EventBus<Event.PROTOCOL_MESSAGE> | ||
|
|
||
| /** | ||
| * Like types | ||
| */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also propagate the bigint here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make this change. Not really sure why we even propagate this other than for debug logging.