1 emitter
ztimson edited this page 2024-09-22 03:11:09 -04:00

@ztimson/utils / emitter

emitter

Classes

TypedEmitter<T>

Extended by

Type Parameters

T extends TypedEvents = TypedEvents

Constructors

new TypedEmitter()

new TypedEmitter<T>(): TypedEmitter<T>

Returns

TypedEmitter<T>

Methods

emit()

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

Type Parameters

K extends string | number | symbol

Parameters

event: K

• ...args: Parameters<T[K]>

Returns

void

Defined in

src/emitter.ts:36

off()

off<K>(event, listener): void

Type Parameters

K extends string | number | symbol = string

Parameters

event: K

listener: T[K]

Returns

void

Defined in

src/emitter.ts:41

on()

on<K>(event, listener): () => void

Type Parameters

K extends string | number | symbol = string

Parameters

event: K

listener: T[K]

Returns

Function

Returns

void

Defined in

src/emitter.ts:45

once()

once<K>(event, listener?): Promise<any>

Type Parameters

K extends string | number | symbol = string

Parameters

event: K

listener?: T[K]

Returns

Promise<any>

Defined in

src/emitter.ts:51

emit()

static emit(event, ...args): void

Parameters

event: any

• ...args: any[]

Returns

void

Defined in

src/emitter.ts:9

off()

static off(event, listener): void

Parameters

event: any

listener: Listener

Returns

void

Defined in

src/emitter.ts:14

on()

static on(event, listener): () => void

Parameters

event: any

listener: Listener

Returns

Function

Returns

void

Defined in

src/emitter.ts:19

once()

static once(event, listener?): Promise<any>

Parameters

event: any

listener?: Listener

Returns

Promise<any>

Defined in

src/emitter.ts:26

Type Aliases

Listener()

Listener: (...args) => any

Parameters

• ...args: any[]

Returns

any

Defined in

src/emitter.ts:1


TypedEvents

TypedEvents: { [k in string | symbol]: Listener } & object

Type declaration

*()

*: (event, ...args) => any

Parameters

event: string

• ...args: any[]

Returns

any

Defined in

src/emitter.ts:2