vapor-chamber API reference - v1.3.0
    Preparing search index...

    Interface BaseBus

    Structural base interface for both sync and async buses. Use this as the parameter type in utilities (createChamber, createWorkflow, etc.) to avoid as any casts when working with either bus variant.

    interface BaseBus {
        dispatch(
            action: string,
            target: any,
            payload?: any,
            options?: DispatchOptions,
        ): any;
        query(action: string, target: any, payload?: any): any;
        emit(event: string, data?: any): void;
        register(
            action: string,
            handler: any,
            options?: RegisterOptions,
        ): () => void;
        use(plugin: any, options?: PluginOptions): () => void;
        onBefore(hook: any): () => void;
        onAfter(hook: any): () => void;
        on(pattern: string, listener: Listener): () => void;
        once(pattern: string, listener: Listener): () => void;
        offAll(pattern?: string): void;
        hasHandler(action: string): boolean;
        registeredActions(): string[];
        clear(): void;
        dispose(): void;
        seal(): void;
        isSealed(): boolean;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Parameters

      • action: string
      • target: any
      • Optionalpayload: any
      • Optionaloptions: DispatchOptions

      Returns any

    • Read-only dispatch — skips beforeHooks, runs handler + plugins, fires afterHooks. No mutation intent.

      Parameters

      • action: string
      • target: any
      • Optionalpayload: any

      Returns any

    • Fire a domain event — notifies on() listeners, no handler required, no result returned.

      Parameters

      • event: string
      • Optionaldata: any

      Returns void

    • Subscribe before dispatch. Throw to cancel (returns { ok: false }).

      Parameters

      • hook: any

      Returns () => void

    • Parameters

      • hook: any

      Returns () => void

    • Remove all on() listeners matching the given pattern, or all listeners if omitted.

      Parameters

      • Optionalpattern: string

      Returns void

    • Parameters

      • action: string

      Returns boolean

    • Returns all registered action names. Useful for introspection and DevTools.

      Returns string[]

    • Full teardown — calls clear() and cancels all pending timers/requests. Use in SSR or component-scoped buses.

      Returns void

    • Seal the bus — prevents further register(), use(), onBefore(), onAfter(), respond() calls. Dispatch, query, emit, on(), once() still work — seal protects the handler/plugin topology, not the observation layer. Listeners via on()/once() can still subscribe after seal. Call after app initialization to lock down the graph in production. Throws BusError with code 'VC_CORE_SEALED' on any mutation attempt. Cleared by clear() for HMR compat.

      Returns void

    • Returns true if the bus has been sealed.

      Returns boolean