@lppedd/message-bus - v0.9.1
    Preparing search index...

    Function createUnicastTopic

    • Creates a new UnicastTopic that can be used to publish or subscribe to messages.

      Type Parameters

      • T = void
      • R = void

      Parameters

      • displayName: string

        A human-readable name for the topic, useful for debugging and logging.

      • Optionaloptions: Partial<TopicOptions>

        Optional topic behavior customizations.

      Returns UnicastTopic<T, R>

      const EnvTopic = createUnicastTopic<string>("Env");
      messageBus.subscribe(EnvTopic, (data) => console.log(data));
      messageBus.publish(EnvTopic, "production"); // => 'production' logged to the console