@toolcog/util/emit
Toolcog utilities
Classes
Emitter<Events>
Extended by
Type Parameters
• Events extends EmitEvents
= EmitEvents
Implements
Emit
<Events
>
Constructors
new Emitter()
new Emitter<
Events
>(options
?):Emitter
<Events
>
Parameters
• options?: EmitterOptions
Returns
Emitter
<Events
>
Defined in
Properties
error
readonly
static
error: typeoferror
Defined in
errorMonitor
readonly
static
errorMonitor: typeoferrorMonitor
Defined in
Methods
addListener()
addListener<
Event
>(event
,listener
,options
?):this
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• listener: EmitListener
<Events
[Event
]>
• options?: EmitListenerOptions
Returns
this
Implementation of
Defined in
emit()
emit<
Event
>(event
, …args
):boolean
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• …args: Events
[Event
]
Returns
boolean
Defined in
events()
events():
IterableIterator
<keyofEvents
,any
,any
>
Returns
IterableIterator
<keyof Events
, any
, any
>
Defined in
listeners()
listeners<
Event
>(event
):IterableIterator
<EmitListener
<Events
[Event
]>,any
,any
>
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
Returns
IterableIterator
<EmitListener
<Events
[Event
]>, any
, any
>
Defined in
on()
on<
Event
>(event
,options
?):AsyncIterableIterator
<Events
[Event
],any
,any
>
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• options?: EmitAsyncOptions
Returns
AsyncIterableIterator
<Events
[Event
], any
, any
>
Implementation of
Defined in
once()
once<
Event
>(event
,options
?):Promise
<Events
[Event
]>
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• options?: EmitAsyncOptions
Returns
Promise
<Events
[Event
]>
Implementation of
Defined in
removeListener()
removeListener<
Event
>(event
,listener
,options
?):this
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• listener: EmitListener
<Events
[Event
]>
• options?: EmitListenerOptions
Returns
this
Implementation of
Defined in
Interfaces
Emit<Events>
Type Parameters
• Events extends EmitEvents
= EmitEvents
Methods
addListener()
addListener<
Event
>(event
,listener
,options
?):this
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• listener: EmitListener
<Events
[Event
]>
• options?: EmitListenerOptions
Returns
this
Defined in
on()
on<
Event
>(event
,options
?):AsyncIterableIterator
<Events
[Event
],any
,any
>
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• options?: EmitAsyncOptions
Returns
AsyncIterableIterator
<Events
[Event
], any
, any
>
Defined in
once()
once<
Event
>(event
,options
?):Promise
<Events
[Event
]>
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• options?: EmitAsyncOptions
Returns
Promise
<Events
[Event
]>
Defined in
removeListener()
removeListener<
Event
>(event
,listener
,options
?):this
Type Parameters
• Event extends string
| number
| symbol
Parameters
• event: Event
• listener: EmitListener
<Events
[Event
]>
• options?: EmitListenerOptions
Returns
this
Defined in
EmitAsyncOptions
Properties
signal?
optional
signal:AbortSignal
Defined in
EmitListenerOptions
Properties
once?
optional
once:boolean
Defined in
EmitterOptions
Extended by
Properties
captureRejections?
optional
captureRejections:boolean
Defined in
Type Aliases
EmitEvents<Event, Args>
EmitEvents<
Event
,Args
>:Record
<Event
,Args
>
Type Parameters
• Event extends string
| symbol
= string
| symbol
• Args extends any
[] = any
[]
Defined in
EmitListener()<Args>
EmitListener<
Args
>: (…args
) =>void
|PromiseLike
<void
>
Type Parameters
• Args extends any
[] = any
[]
Parameters
• …args: Args
Returns
void
| PromiseLike
<void
>