Skip to content

@toolcog/util/emit

Toolcog utilities

Classes

Emitter<Events>

Extended by

Type Parameters

Events extends EmitEvents = EmitEvents

Implements

Constructors

new Emitter()

new Emitter<Events>(options?): Emitter<Events>

Parameters

options?: EmitterOptions

Returns

Emitter<Events>

Defined in

emitter.ts:36

Properties

error

readonly static error: typeof error

Defined in

emitter.ts:30

errorMonitor

readonly static errorMonitor: typeof errorMonitor

Defined in

emitter.ts:31

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

Emit.addListener

Defined in

emitter.ts:41

emit()

emit<Event>(event, …args): boolean

Type Parameters

Event extends string | number | symbol

Parameters

event: Event

• …args: Events[Event]

Returns

boolean

Defined in

emitter.ts:218

events()

events(): IterableIterator<keyof Events, any, any>

Returns

IterableIterator<keyof Events, any, any>

Defined in

emitter.ts:268

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

emitter.ts:272

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

Emit.on

Defined in

emitter.ts:72

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

Emit.once

Defined in

emitter.ts:169

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

Emit.removeListener

Defined in

emitter.ts:51

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

emit.ts:21

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

emit.ts:33

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

emit.ts:38

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

emit.ts:27


EmitAsyncOptions

Properties

signal?

optional signal: AbortSignal

Defined in

emit.ts:11


EmitListenerOptions

Properties

once?

optional once: boolean

Defined in

emit.ts:7


EmitterOptions

Extended by

Properties

captureRejections?

optional captureRejections: boolean

Defined in

emitter.ts:26

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

emit.ts:14


EmitListener()<Args>

EmitListener<Args>: (…args) => void | PromiseLike<void>

Type Parameters

Args extends any[] = any[]

Parameters

• …args: Args

Returns

void | PromiseLike<void>

Defined in

emit.ts:2