strongbus - v3.1.0
    Preparing search index...

    Interface ControlSurface<TEventMap>

    Emit events and tear down a Bus instance.

    Extends EmittingSurface with ControlSurface.destroy and ControlSurface.clear. Prefer EmittingSurface when a dependency may raise events but must not destroy or clear the bus.

    Event-map typing is bivariant (no in out) so a surface over a wider map is assignable to a narrower view — the same Wide→Narrow shape as Bus.

    interface ControlSurface<TEventMap extends EventMap = EventMap> {
        destroy(reason?: string): void;
        clear(options?: IntrospectionOptions): void;
        emit: {
            <T extends string | number | symbol>(event: T, payload?: null): boolean;
            <T extends string | number | symbol>(
                event: T,
                payload: TEventMap[T],
            ): boolean;
            (
                ...args: {
                    [K in string | number | symbol]: [event: K, payload: TEventMap[K]]
                }[keyof TEventMap],
            ): boolean;
        };
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index
    emit: {
        <T extends string | number | symbol>(event: T, payload?: null): boolean;
        <T extends string | number | symbol>(
            event: T,
            payload: TEventMap[T],
        ): boolean;
        (
            ...args: {
                [K in string | number | symbol]: [event: K, payload: TEventMap[K]]
            }[keyof TEventMap],
        ): boolean;
    }

    Type Declaration

      • <T extends string | number | symbol>(event: T, payload?: null): boolean
      • Emit a void event with no payload (or an explicit null/undefined).

        Type Parameters

        • T extends string | number | symbol

        Parameters

        • event: T
        • Optionalpayload: null

        Returns boolean

      • <T extends string | number | symbol>(event: T, payload: TEventMap[T]): boolean
      • Emit an event with its correlated payload. The payload is required for any event whose mapped type is not void; correlating it directly (rather than through a rest tuple) lets it type-check even when TEventMap is a generic type parameter, or when forwarding by a generic key over a concrete map (T extends keyof M).

        Type Parameters

        • T extends string | number | symbol

        Parameters

        Returns boolean

      • (
            ...args: {
                [K in string | number | symbol]: [event: K, payload: TEventMap[K]]
            }[keyof TEventMap],
        ): boolean
      • Correlated-tuple form: the (event, payload) pair must be one of the [event, payload] tuples of TEventMap. Use this after discriminating on event when both values started as independent unions.

        Parameters

        • ...args: { [K in string | number | symbol]: [event: K, payload: TEventMap[K]] }[keyof TEventMap]

        Returns boolean

    • Remove listeners and pipe edges in options.scope (default ListenerScope.ANY), and cancel pending next / scan promises when the scope includes OWN, leaving the bus usable. Lifecycle hooks stay registered. options.includeIncognito defaults to true.

      Parameters

      Returns void