This repository has been archived by the owner on May 17, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jordan Danford
committed
Jun 23, 2017
1 parent
eda19e8
commit dec38a0
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
type EventKey = string|RegExp; | ||
|
||
interface EventMap { | ||
[evt: string]: EventKey; | ||
} | ||
|
||
type Events = EventKey|EventMap; | ||
|
||
interface Listener { | ||
listener: Function; | ||
once: boolean; | ||
} | ||
|
||
interface ListenerMap { | ||
[evt: string]: Listener[]; | ||
} | ||
|
||
type Listeners = Listener[]|ListenerMap; | ||
|
||
declare class EventEmitter { | ||
getListeners(evt: EventKey): Listeners; | ||
flattenListeners(listeners: Listener[]): void; | ||
getListenersAsObject(evt: EventKey): ListenerMap; | ||
addListener(evt: EventKey, listener: Listener|Function): this; | ||
on(evt: EventKey, listener: Listener|Function): this; | ||
addOnceListener(evt: EventKey, listener: Function): this; | ||
once(evt: EventKey, listener: Function): this; | ||
defineEvent(evt: EventKey): this; | ||
defineEvents(evts: EventKey[]): this; | ||
removeListener(evt: EventKey, listener: Function): this; | ||
off(evt: EventKey, listener: Function): this; | ||
addListeners(evt: Events, listeners: Function[]): this; | ||
removeListeners(evt: Events, listeners: Function[]): this; | ||
manipulateListeners(remove: boolean, evt: Events, listeners: Function[]): this; | ||
removeEvent(evt: EventKey): this; | ||
removeAllListeners(evt: EventKey): this; | ||
emitEvent(evt: EventKey, args?: any[]): this; | ||
trigger(evt: EventKey, args?: any[]): this; | ||
emit(evt: EventKey): this; | ||
setOnceReturnValue(value: any): this; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters