import { Source, Subscriber, Subscription } from "../_core"; import { Transaction } from "../_tx"; import { EventStream } from "../EventStream"; import { Indexed, IndexedEndSubscriber, IndexedSource } from "./_indexed"; import { JoinOperator } from "./_join"; export declare function when(...patternsAndHandlers: any[]): EventStream; export declare function _when(patternsAndHandlers: any[], spreadHandlerArgs: boolean): EventStream; export declare function extractPatternsAndBuffers(patternsAndHandlers: any[], spreadHandlerArgs: boolean): [Pattern[], Buffer[], Buffered[]]; export declare class When extends JoinOperator, any> implements IndexedEndSubscriber { private patterns; private buffers; private activePatterns; constructor(source: IndexedSource, patterns: Pattern[], buffers: Buffer[]); dispose(): void; next(tx: Transaction, val: Indexed): void; error(tx: Transaction, err: Error): void; iend(tx: Transaction, idx: number, source: IndexedSource): void; joinNext(tx: Transaction, _: null): void; protected handleMatch(tx: Transaction, match: Pattern, vals: any[]): void; private resetBuffers; } export declare class Buffered implements Subscriber, Source, Subscription { private src; private buf; readonly weight: number; private sub; private sink; constructor(src: Source, buf: Buffer); subscribe(subscriber: Subscriber, order: number): Subscription; activate(initialNeeded: boolean): void; dispose(): void; reorder(order: number): void; next(tx: Transaction, val: any): void; error(tx: Transaction, err: Error): void; end(tx: Transaction): void; } declare enum PeekResult { READY = 2, STANDBY = 1, UNREACHABLE = 0 } declare type PatternHandler = (...args: any[]) => any; export declare class Pattern { f: PatternHandler; private readonly READY; private ppeek; private ppop; constructor(ah: number[][], f: PatternHandler); peek(buffers: Buffer[]): PeekResult; pop(buffers: Buffer[]): any[]; } export interface Buffer { push(x: any): boolean; peek(n: number): PeekResult; pop(): any; end(): boolean; reset(): void; } export {};