UNPKG

1.29 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/component-emitter`
3
4# Summary
5This package contains type definitions for component-emitter (https://www.npmjs.com/package/component-emitter).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter/index.d.ts)
10````ts
11// TypeScript Version: 2.2
12
13interface Emitter<Event = string> {
14 on(event: Event, listener: Function): Emitter;
15 once(event: Event, listener: Function): Emitter;
16 off(event?: Event, listener?: Function): Emitter;
17 emit(event: Event, ...args: any[]): Emitter;
18 listeners(event: Event): Function[];
19 hasListeners(event: Event): boolean;
20 removeListener(event?: Event, listener?: Function): Emitter;
21 removeEventListener(event?: Event, listener?: Function): Emitter;
22 removeAllListeners(event?: Event): Emitter;
23}
24
25declare const Emitter: {
26 (obj?: object): Emitter;
27 new(obj?: object): Emitter;
28};
29
30export = Emitter;
31
32````
33
34### Additional Details
35 * Last updated: Mon, 06 Nov 2023 22:41:05 GMT
36 * Dependencies: none
37
38# Credits
39These definitions were written by [Peter Snider](https://github.com/psnider).
40
\No newline at end of file