1 | import { AsyncIterableX } from './asynciterablex';
|
2 | export interface NodeEventEmitter {
|
3 | addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
4 | removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
5 | }
|
6 | export declare type EventListenerOptions = {
|
7 | capture?: boolean;
|
8 | passive?: boolean;
|
9 | once?: boolean;
|
10 | } | boolean;
|
11 | export declare type EventedTarget = EventTarget | NodeEventEmitter;
|
12 | /**
|
13 | * Converts an event emitter event into an async-iterable stream.
|
14 | *
|
15 | * @export
|
16 | * @template TSource The type of elements in the emitter stream.
|
17 | * @param {EventedTarget} obj The object that emits the events to turn into an async-iterable.
|
18 | * @param {string} type The name of the event to listen for creation of the async-iterable.
|
19 | * @param {EventListenerOptions} [options] The options for listening to the events such as capture, passive and once.
|
20 | * @returns {AsyncIterableX<TSource>} An async-iterable sequence created from the events emitted from the evented target.
|
21 | */
|
22 | export declare function fromEvent<TSource>(obj: EventedTarget, type: string, options?: EventListenerOptions): AsyncIterableX<TSource>;
|