Function fromEventPattern

  • Creates async-iterable from an event emitter by adding handlers for both listening and unsubscribing from events.

    Type Parameters

    • TSource

      The type of elements in the event emitter.

    Parameters

    • addHandler: ((handler) => void)

      The function to add a listener to the source.

        • (handler): void
        • Parameters

          • handler: ((...args) => void)
              • (...args): void
              • Parameters

                • Rest ...args: any[]

                Returns void

          Returns void

    • removeHandler: ((handler) => void)

      The function to remove a listener from the source.

        • (handler): void
        • Parameters

          • handler: ((...args) => void)
              • (...args): void
              • Parameters

                • Rest ...args: any[]

                Returns void

          Returns void

    • Optional resultSelector: ((...args) => TSource)
        • (...args): TSource
        • Parameters

          • Rest ...args: any[]

          Returns TSource

    Returns AsyncIterable<TSource>

    An async-iterable which contains the data from the underlying events as wrapped by the handlers.

Generated using TypeDoc