BSB Node.js Type Definitions
    Preparing search index...

    Class PluginEvents<TEventSchemas, TClientApi>

    Schema-first plugin events handler with automatic validation and object parameters.

    Type Parameters

    Index

    Constructors

    Methods

    • Listen for broadcast events emitted by other plugins with full type safety.

      Type Parameters

      Parameters

      • eventName: K

        Name of the event to listen for (strongly typed)

      • obs: Observable

        Observable context (v9 BREAKING: Observable only, no longer accepts DTrace)

      • listener: (handlerObs: Observable, input: EventInputType<TBroadcast[K]>) => Promise<void>

        Function to call when event is received (receives Observable and validated input object)

      Returns Promise<void>

    • Listen for fire-and-forget events from other plugins with full type safety.

      Type Parameters

      Parameters

      • eventName: K

        Name of the event to listen for (strongly typed)

      • obs: Observable

        Observable context (v9 BREAKING: Observable only, no longer accepts DTrace)

      • listener: (handlerObs: Observable, input: EventInputType<TEvents[K]>) => Promise<void>

        Function to call when event is received (receives Observable and validated input object)

      Returns Promise<void>

    • Get stream ID for receiving streamed data from another plugin.

      Parameters

      • trace: DTrace

        Trace for logging context

      • eventName: string

        Name of the stream event

      • listener: (error: Error | null, stream: Readable) => Promise<void>

        Function called when stream is received

      • OptionaltimeoutSeconds: number

        Optional timeout in seconds

      Returns Promise<string>

    • Send stream data to another plugin.

      Parameters

      • trace: DTrace

        Trace for logging context

      • eventName: string

        Name of the stream event

      • streamId: string

        ID of the stream to send to

      • stream: Readable

        The readable stream to send

      Returns Promise<void>