Leo Wallet Docs
Ask or search…
K
Links

EventEmitter-1

Class: EventEmitter<EventTypes, Context>

Minimal EventEmitter interface that is molded against the Node.js EventEmitter interface.

Type parameters

Name
Type
EventTypes
extends ValidEventTypes = string | symbol
Context
extends any = any

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EventEmitter<EventTypes, Context>()
Type parameters
Name
Type
EventTypes
extends ValidEventTypes = string | symbol
Context
extends unknown = any

Properties

prefixed

Static prefixed: string | boolean
Defined in
node_modules/eventemitter3/index.d.ts:9

Methods

addListener

addListener<T>(event, fn, context?): EventEmitter<EventTypes, Context>
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
fn
EventListener<EventTypes, T>
context?
Context
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:45

emit

emit<T>(event, ...args): boolean
Calls each of the listeners registered for a given event.
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
...args
Parameters<EventListener<EventTypes, T>>
Returns
boolean
Defined in
node_modules/eventemitter3/index.d.ts:32

eventNames

eventNames(): EventNames<EventTypes>[]
Return an array listing the events for which the emitter has registered listeners.
Returns
EventNames<EventTypes>[]
Defined in
node_modules/eventemitter3/index.d.ts:15

listenerCount

listenerCount(event): number
Return the number of listeners listening to a given event.
Parameters
Name
Type
event
EventNames<EventTypes>
Returns
number
Defined in
node_modules/eventemitter3/index.d.ts:27

listeners

listeners<T>(event): EventListener<EventTypes, T>[]
Return the listeners registered for a given event.
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
Returns
EventListener<EventTypes, T>[]
Defined in
node_modules/eventemitter3/index.d.ts:20

off

off<T>(event, fn?, context?, once?): EventEmitter<EventTypes, Context>
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
fn?
EventListener<EventTypes, T>
context?
Context
once?
boolean
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:69

on

on<T>(event, fn, context?): EventEmitter<EventTypes, Context>
Add a listener for a given event.
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
fn
EventListener<EventTypes, T>
context?
Context
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:40

once

once<T>(event, fn, context?): EventEmitter<EventTypes, Context>
Add a one-time listener for a given event.
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
fn
EventListener<EventTypes, T>
context?
Context
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:54

removeAllListeners

removeAllListeners(event?): EventEmitter<EventTypes, Context>
Remove all listeners, or those of the specified event.
Parameters
Name
Type
event?
EventNames<EventTypes>
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:79

removeListener

removeListener<T>(event, fn?, context?, once?): EventEmitter<EventTypes, Context>
Remove the listeners of a given event.
Type parameters
Name
Type
T
extends string | symbol
Parameters
Name
Type
event
T
fn?
EventListener<EventTypes, T>
context?
Context
once?
boolean
Returns
EventEmitter<EventTypes, Context>
Defined in
node_modules/eventemitter3/index.d.ts:63