import { Channel } from './Channel'; import { ParallelCommunicator, ParallelDataCombiner, ParallelDataDistributor, StorageChannelCommunicator, WebWorkerCommunicator, WebWorkerScopeCommunicator, WindowChannelCommunicator } from './communicators'; import { CommunicationData, Communicator } from './types'; interface ChannelFactory { create(): Channel; } declare class WindowChannelChainGenerator implements ChannelFactory { private readonly channelId; private readonly win; private readonly targetOrigin; constructor(channelId: string, win: Window, targetOrigin?: string); origin(targetOrigin?: string): ChannelFactory; create(): Channel; } declare class StorageChannelChainGenerator implements ChannelFactory { private readonly channelId; private readonly storage; constructor(channelId: string, storage: Storage); create(): Channel; } declare class WebWorkerChannelChainGenerator implements ChannelFactory { private readonly channelId; private readonly workerScriptURL; private readonly workerOptions?; constructor(channelId: string, workerScriptURL: string, workerOptions?: WorkerOptions | undefined); options(opts: WorkerOptions): ChannelFactory; create(): Channel; } declare class ParallelChannelChainGenerator { private readonly channelId; private readonly communicators; constructor(channelId: string, communicators: Communicator[]); distributor(distributorFn: ParallelDataDistributor): ParallelChannelChainGenerator_Combiner; } declare class ParallelChannelChainGenerator_Combiner { private readonly channelId; private readonly communicators; private readonly distributorFn; constructor(channelId: string, communicators: Communicator[], distributorFn: ParallelDataDistributor); combiner(combinerFn: ParallelDataCombiner): ChannelFactory; } export declare function channel(channelId: string): { connectToOtherWindow(targetWindow: Window): WindowChannelChainGenerator; connectViaStorage(storage: Storage): StorageChannelChainGenerator; connectToWorker(workerScriptURL: string): WebWorkerChannelChainGenerator; connectToMainThread(): ChannelFactory; parallel(parallels: number, generator: (index: number) => T): ParallelChannelChainGenerator; connectTo(communicator: Communicator): { create(): Channel; }; }; export declare const communicators: { windowChannel(targetWindow: Window, targetOrigin?: string): WindowChannelCommunicator; storage(targetStorage: Storage, channelId: string): StorageChannelCommunicator; webWorker(workerScriptURL: string, options?: WorkerOptions): WebWorkerCommunicator; webWorkerScope(): WebWorkerScopeCommunicator; parallel(communicators: Communicator[], distributorFn: ParallelDataDistributor, combinerFn: ParallelDataCombiner): ParallelCommunicator; }; export {};