Class: EventEmitter<TEventMap>
utilities/events.EventEmitter
Type parameters
Name | Type |
---|---|
TEventMap | extends EventMap = {} |
Hierarchy
EventEmitter
Constructors
constructor
• new EventEmitter<TEventMap
>(): EventEmitter
<TEventMap
>
Type parameters
Name | Type |
---|---|
TEventMap | extends EventMap = {} |
Returns
EventEmitter
<TEventMap
>
Defined in
Methods
emit
▸ emit<K
>(event
, ...args
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type |
---|---|
event | K |
...args | TEventMap [K ] |
Returns
void
Defined in
events
▸ events(): string
[]
Returns
string
[]
Defined in
hasListeners
▸ hasListeners<K
>(event
): boolean
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type |
---|---|
event | K |
Returns
boolean
Defined in
listeners
▸ listeners<K
>(event
): ListenerInfo
<any
[]>[]
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type |
---|---|
event | K |
Returns
ListenerInfo
<any
[]>[]
Defined in
makeEvent
▸ makeEvent<TData
>(data
): TypedFFZEvent
<TData
>
Create a new FFZEvent instance. This is a convenience method that wraps ()
Type parameters
Name | Type |
---|---|
TData | extends Record <string , any > = {} |
Parameters
Name | Type |
---|---|
data | TData |
Returns
TypedFFZEvent
<TData
>
Defined in
makeWaitableEvent
▸ makeWaitableEvent<TData
, TReturn
>(data
): TypedFFZWaitableEvent
<TData
, TReturn
>
Create a new FFZWaitableEvent instance. This is a convenience method that wraps ()
Type parameters
Name | Type |
---|---|
TData | extends Record <string , any > = {} |
TReturn | void |
Parameters
Name | Type |
---|---|
data | TData |
Returns
TypedFFZWaitableEvent
<TData
, TReturn
>
Defined in
many
▸ many<K
>(event
, ttl
, fn
, ctx?
, priority?
, prepend?
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Default value |
---|---|---|
event | K | undefined |
ttl | number | undefined |
fn | EventListener <TEventMap [K ]> | undefined |
ctx? | any | undefined |
priority? | number | undefined |
prepend | boolean | false |
Returns
void
Defined in
off
▸ off<K
>(event?
, fn?
, ctx?
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type |
---|---|
event? | K |
fn? | EventListener <any []> |
ctx? | any |
Returns
void
Defined in
offContext
▸ offContext<K
>(event
, ctx?
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type |
---|---|
event | K |
ctx? | any |
Returns
void
Defined in
on
▸ on<K
>(event
, fn
, ctx?
, priority?
, prepend?
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Default value |
---|---|---|
event | K | undefined |
fn | EventListener <TEventMap [K ]> | undefined |
ctx? | any | undefined |
priority? | number | undefined |
prepend | boolean | false |
Returns
void
Defined in
once
▸ once<K
>(event
, fn
, ctx?
, priority?
, prepend?
): void
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Default value |
---|---|---|
event | K | undefined |
fn | EventListener <TEventMap [K ]> | undefined |
ctx? | any | undefined |
priority? | number | undefined |
prepend | boolean | false |
Returns
void
Defined in
waitFor
▸ waitFor<K
>(event
, ctx?
, priority?
, prepend?
): Promise
<TEventMap
[K
]>
Type parameters
Name | Type |
---|---|
K | extends string |
Parameters
Name | Type | Default value |
---|---|---|
event | K | undefined |
ctx? | any | undefined |
priority? | number | undefined |
prepend | boolean | false |
Returns
Promise
<TEventMap
[K
]>