pamoja for TypeScript - v0.1.17
    Preparing search index...

    Class EventBus

    One endpoint on an event bus.

    An endpoint both publishes and receives. Each subscriber needs its own, taken with subscribe, because an endpoint only sees events published after it existed.

    Index
    • Creates an event bus.

      Parameters

      • capacity: number

        how many events a slow subscriber may fall behind before it starts missing them.

      Returns bus.EventBus

    • Waits for the next event on this endpoint, or null once the bus closes.

      Returns Promise<Buffer<ArrayBufferLike> | null>

    • Publishes an event to every subscriber.

      Parameters

      • event: Buffer

      Returns Promise<void>

    • Takes another endpoint on the same bus.

      The new endpoint sees events published from now on, not those already sent, so subscribe before publishing anything it needs to see.

      Returns Promise<bus.EventBus>