@urth/metatell-sdk - v0.1.0
    Preparing search index...

    Function on

    • Subscribe to an event on the bus. The payload type is inferred from evt.

      Type Parameters

      Parameters

      • evt: K

        The event name (a key of EventMap).

      • fn: (payload: EventMap[K]) => void

        Handler that receives the event payload.

      Returns Unsubscribe

      A function that cancels the subscription. Call it on teardown.

      import { on } from "@urth/metatell-sdk/events";

      const off = on("chat:message", (m) => console.log(m.text));