@alwaysblank/denden
    Preparing search index...

    Function until

    • Remove subscription when test evaluates to true.

      Type Parameters

      • Payload extends unknown

      Parameters

      • hub: Hub

        The hub this listener should attach to.

      • channel: ChannelRoute

        The channel to subscribe to.

      • callback: Callback<Payload>

        Called with the payload, message, and unsub function when a message is published.

      • test: (payload: Payload, message: Message<Payload>) => boolean

        Function that determines if the subscription should be removed.

      • OptionalincludeMatch: boolean = true

        If true, the payload that matches test will be sent to callback; if false, then the listener will be removed without invoking the callback.

      • 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();

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

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