Skip to content

Class: EventEmitter<TEventMap>

utilities/events.EventEmitter

Type parameters

NameType
TEventMapextends EventMap = {}

Hierarchy

Constructors

constructor

new EventEmitter<TEventMap>(): EventEmitter<TEventMap>

Type parameters

NameType
TEventMapextends EventMap = {}

Returns

EventEmitter<TEventMap>

Defined in

src/utilities/events.ts:75

Methods

emit

emit<K>(event, ...args): void

Type parameters

NameType
Kextends string

Parameters

NameType
eventK
...argsTEventMap[K]

Returns

void

Defined in

src/utilities/events.ts:292


events

events(): string[]

Returns

string[]

Defined in

src/utilities/events.ts:278


hasListeners

hasListeners<K>(event): boolean

Type parameters

NameType
Kextends string

Parameters

NameType
eventK

Returns

boolean

Defined in

src/utilities/events.ts:288


listeners

listeners<K>(event): ListenerInfo<any[]>[]

Type parameters

NameType
Kextends string

Parameters

NameType
eventK

Returns

ListenerInfo<any[]>[]

Defined in

src/utilities/events.ts:283


makeEvent

makeEvent<TData>(data): TypedFFZEvent<TData>

Create a new FFZEvent instance. This is a convenience method that wraps ()

Type parameters

NameType
TDataextends Record<string, any> = {}

Parameters

NameType
dataTData

Returns

TypedFFZEvent<TData>

Defined in

src/utilities/events.ts:118


makeWaitableEvent

makeWaitableEvent<TData, TReturn>(data): TypedFFZWaitableEvent<TData, TReturn>

Create a new FFZWaitableEvent instance. This is a convenience method that wraps ()

Type parameters

NameType
TDataextends Record<string, any> = {}
TReturnvoid

Parameters

NameType
dataTData

Returns

TypedFFZWaitableEvent<TData, TReturn>

Defined in

src/utilities/events.ts:128


many

many<K>(event, ttl, fn, ctx?, priority?, prepend?): void

Type parameters

NameType
Kextends string

Parameters

NameTypeDefault value
eventKundefined
ttlnumberundefined
fnEventListener<TEventMap[K]>undefined
ctx?anyundefined
priority?numberundefined
prependbooleanfalse

Returns

void

Defined in

src/utilities/events.ts:170


off

off<K>(event?, fn?, ctx?): void

Type parameters

NameType
Kextends string

Parameters

NameType
event?K
fn?EventListener<any[]>
ctx?any

Returns

void

Defined in

src/utilities/events.ts:228


offContext

offContext<K>(event, ctx?): void

Type parameters

NameType
Kextends string

Parameters

NameType
eventK
ctx?any

Returns

void

Defined in

src/utilities/events.ts:274


on

on<K>(event, fn, ctx?, priority?, prepend?): void

Type parameters

NameType
Kextends string

Parameters

NameTypeDefault value
eventKundefined
fnEventListener<TEventMap[K]>undefined
ctx?anyundefined
priority?numberundefined
prependbooleanfalse

Returns

void

Defined in

src/utilities/events.ts:132


once

once<K>(event, fn, ctx?, priority?, prepend?): void

Type parameters

NameType
Kextends string

Parameters

NameTypeDefault value
eventKundefined
fnEventListener<TEventMap[K]>undefined
ctx?anyundefined
priority?numberundefined
prependbooleanfalse

Returns

void

Defined in

src/utilities/events.ts:160


waitFor

waitFor<K>(event, ctx?, priority?, prepend?): Promise<TEventMap[K]>

Type parameters

NameType
Kextends string

Parameters

NameTypeDefault value
eventKundefined
ctx?anyundefined
priority?numberundefined
prependbooleanfalse

Returns

Promise<TEventMap[K]>

Defined in

src/utilities/events.ts:202