Skip to content

Commit

Permalink
Add eventemitter3 as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Oct 12, 2023
1 parent e515cd6 commit 76f8c93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 7 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@substreams/node",
"version": "0.2.2",
"version": "0.3.0",
"description": "Substreams for Node.js",
"license": "MIT",
"repository": "substreams-js/substreams-node",
Expand All @@ -22,7 +22,8 @@
"@bufbuild/connect": "latest",
"@bufbuild/connect-node": "latest",
"@bufbuild/protobuf": "latest",
"@substreams/core": "^0.1.18"
"@substreams/core": "^0.1.19",
"eventemitter3": "latest"
},
"devDependencies": {
"@tsconfig/recommended": "latest",
Expand Down
13 changes: 3 additions & 10 deletions src/BlockEmitter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { EventEmitter } from "node:events";
import type { CallOptions, Transport } from "@bufbuild/connect";
import { createPromiseClient } from "@bufbuild/connect";
import { AnyMessage, IMessageTypeRegistry, JsonObject, Message } from "@bufbuild/protobuf";
Expand All @@ -15,6 +14,7 @@ import type {
SessionInit,
} from "@substreams/core/proto";
import { Stream } from "@substreams/core/proto";
import { EventEmitter } from "eventemitter3";

export class TypedEventEmitter<TEvents extends Record<string, any>> {
private emitter = new EventEmitter();
Expand Down Expand Up @@ -55,15 +55,8 @@ export class TypedEventEmitter<TEvents extends Record<string, any>> {
return this.emitter.eventNames();
}

getMaxListeners() {
return this.emitter.getMaxListeners();
}

listenerCount<TEventName extends keyof TEvents & string>(
eventName: TEventName,
handler: (...eventArg: TEvents[TEventName]) => void,
) {
return this.emitter.listenerCount(eventName, handler as any);
listenerCount<TEventName extends keyof TEvents & string>(eventName: TEventName) {
return this.emitter.listenerCount(eventName);
}

off<TEventName extends keyof TEvents & string>(
Expand Down

0 comments on commit 76f8c93

Please sign in to comment.