Skip to content

Commit

Permalink
chore: add removeListener typings
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Oct 4, 2021
1 parent 6bd7817 commit 908fbc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
interface Emitter<Event = string> {
on(event: Event, listener: Function): Emitter;
once(event: Event, listener: Function): Emitter;
off(event?: Event, listener?: Function): Emitter;
emit(event: Event, ...args: any[]): Emitter;
listeners(event: Event): Function[];
hasListeners(event: Event): boolean;
removeListener(event?: Event, listener?: Function): Emitter;
removeEventListener(event?: Event, listener?: Function): Emitter;
removeAllListeners(event?: Event): Emitter;
}

declare const Emitter: {
(obj?: object): Emitter;
new (obj?: object): Emitter;
};

export = Emitter;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
}
},
"main": "index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/component/emitter.git"
Expand All @@ -22,6 +23,7 @@
},
"files": [
"index.js",
"index.d.ts",
"LICENSE"
]
}

0 comments on commit 908fbc4

Please sign in to comment.