@alwaysblank/denden
    Preparing search index...

    Function firstAsync

    • Identical in behavior to first, but returns a Promise instead of accepting a callback.

      Type Parameters

      • T

      Parameters

      • hub: Hub

        The Hub instance to which this will subscribe.

      • routes: ChannelRoute[]

        An array of route descriptors (see Hub for details on valid route descriptors).

      • waitTime: number

        Time in milliseconds to wait for a message before timing out.

      Returns Promise<WaitForResults<T>>

      const hub = new Hub();

      firstAsync(hub, ['sandwich', 'soup'], 1000)
      .then(r => console.log(`first: ${r}`));

      hub.pub('sandwich', 'reuben');
      hub.pub('sandwich', 'club');
      hub.pub('soup', 'chicken');

      // "first: [['sandwich', 'reuben'], ['soup', 'chicken']]"