import { IChannelMessage } from "./channel"; import { EventIterable } from "./generator"; import { IHub } from "./IHub"; import { IChannel } from "./IChannel"; import { EventMiddleware } from "./types"; export declare const channelReturnSym: string | symbol; declare class _HubInternal implements IHub { private static globalGeneratorMiddlewares; private _generatorMiddlewares; private eventMiddleware; private _globalChannel; private readonly options; get generatorMiddlewares(): { [name: string]: Array<(args: EventIterable, channel: IChannel) => Promise>; }; private channels; get global(): IChannel; constructor(options: CreateHubOptions); addEventMiddleware(...middleware: EventMiddleware[]): void; newChannel; } = any>(id?: string): IChannel; dispose(): void; handleSend(type: string, payload: any, sender: IChannel): any; static addGlobalGeneratorMiddleware(functionName: string, middleware: (args: EventIterable, channel: IChannel) => Promise): void; addGeneratorMiddleware(functionName: string, middleware: (args: EventIterable, channel?: IChannel) => Promise): void; addGlobalGeneratorMiddleware(functionName: string, middleware: (args: EventIterable, channel: IChannel) => Promise): void; } declare type CreateHubOptions = { /** Log all send events */ enableLogging?: boolean; /** * Tap into event pipeline by providing middleware functions. Call `next` and return the result inside the supplied function * to proceed the event */ eventMiddleware?: Array; }; export declare function createHub(options?: CreateHubOptions): IHub; export declare type t_HubInternal = _HubInternal; /** * Same as `addGeneratorMiddleware` but adds to all future `IHub` instances in the program. Existing `IHub` instances will NOT recieve the middleware * @param functionName The name of this generator middleware to be added * @param middleware The middleware implementation that takes 1-2 args: The `EventIterable` that was yielded, in the generator, and a reference to the `IChannel` object */ export declare const addGlobalGeneratorMiddleware: IHub["addGlobalGeneratorMiddleware"]; export {};