@alwaysblank/denden
    Preparing search index...

    Function once

    • Run a callback once.

      Type Parameters

      • Payload extends unknown

      Parameters

      • hub: Hub

        The hub this listener should attach to.

      • channel: ChannelRoute

        Name of the channel to subscribe to. Does not need to exist to be subscribed to. Passing * will subscribe to all channels.

      • callback: Callback<Payload>

        Called with message payload and channel name when a message is published.

      • OptionalonlyFuture: boolean = false

        If true, callback will fire only for messages dispatched in the future. If false, messages in the backlog will also be considered.

      Returns (reason?: string) => void

      const hub = new Hub();

      once(hub, 'sandwiches', (p) => console.log(`once: ${p}`));

      hub.pub('sandwiches', 'reuben sandwich');
      // "once: reuben sandwich"
      hub.pub('sandwiches', 'chicken sandwich');
      // Nothing printed.