Skip to content

Events

Options accepted by ctx.on() and ctx.once().

/** Options accepted by `ctx.on()` and `ctx.once()`. */
interface EventOptions {
/** Add the listener before existing listeners for the same event. */
prepend?: boolean
/** Receive the event regardless of context filter checks. */
global?: boolean
}

Source

Event dispatch strategy used by the event service.

emit runs synchronous listeners without awaiting them, parallel awaits all listeners together, serial awaits them in order until one bails, bail stops on the first synchronous bail value, and waterfall composes listeners around a final next callback.

/**
* Event dispatch strategy used by the event service.
*
* `emit` runs synchronous listeners without awaiting them, `parallel` awaits
* all listeners together, `serial` awaits them in order until one bails,
* `bail` stops on the first synchronous bail value, and `waterfall` composes
* listeners around a final `next` callback.
*/
type DispatchMode = 'emit' | 'parallel' | 'serial' | 'bail' | 'waterfall'

Source