Skip to main content

emitCoreEvent

@webda/core


Function: emitCoreEvent()

emitCoreEvent<K>(event, data): void

Defined in: packages/core/src/events/events.ts:86

Emit a core event.

Async listeners can return a rejected promise that would otherwise escape as an unhandled rejection and crash the process. We iterate listeners manually so we can attach a .catch() on async returns and isolate sync throws — listeners must never take down the emitter's caller.

Type Parameters​

K​

K extends keyof CoreEvents

Parameters​

event​

K

the event name

data​

CoreEvents[K]

the data to process

Returns​

void