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

    Function createTopic

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

      Type Parameters

      • T

      Parameters

      • displayName: string

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

      • broadcastDirection: BroadcastDirection = "children"

        The broadcasting direction for the topic. children by default.

      Returns Topic<T>

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