Type Alias IEventBus<TEvents>

IEventBus<TEvents>: IEventListener<TEvents> & IEventDispatcher<TEvents> & {
    getGroup(): string;
}

The IEventBus contract defines a way for dispatching and listening to events independent of underlying technology. It commes with more convient methods compared to IEventBusAdapter.

Type Parameters

Type declaration

  • getGroup:function
    • The getGroup method returns the complete group.

      Returns string

      import { type IEventBus } from "@daiso-tech/core";

      async function main(eventBus: IEventBus): Promise<void> {
      // Will be "@root"
      console.log(eventBus.getGroup())

      const eventBusA = eventBus.withGroup("a");

      // Will be "@root/a"
      console.log(eventBusA.getGroup())
      }