UNPKG

816 BTypeScriptView Raw
1import { AsyncIterableX } from './asynciterablex';
2/**
3 * Creates asnyc-iterable from an event emitter by adding handlers for both listening and unsubscribing from events.
4 *
5 * @export
6 * @template TSource The type of elements in the event emitter.
7 * @param {(handler: (...args: any[]) => void) => void} addHandler The function to add a listener to the source.
8 * @param {(handler: (...args: any[]) => void) => void} removeHandler The function to remove a listener from the source.
9 * @returns {AsyncIterableX<TSource>} An async-iterable which contains the data from the underlying events as wrapped by the handlers.
10 */
11export declare function fromEventPattern<TSource>(addHandler: (handler: (...args: any[]) => void) => void, removeHandler: (handler: (...args: any[]) => void) => void): AsyncIterableX<TSource>;