import { Container } from './core'; import Message, { MessageConstructor } from './message'; import ExecContext, { ExecContextPartial } from './runtime/exec_context'; import StateManager from './runtime/state_manager'; import { ProcessState } from './subscription'; export declare type Dispatcher = (...args: any[]) => any | void; export declare type CommandDispatcher = (data: object, dispatch: Dispatcher) => any | void; export declare type SubscriptionDispatcher = (processState: ProcessState, dispatch: Dispatcher) => any | void; export declare type EnvDefPartial = { dispatcher: any; log?: (...args: any[]) => any | void; stateManager?: (container?: Container) => StateManager; displayError?: Renderer; }; export declare type EnvDef = EnvDefPartial & { effects: Map; }; export declare type Environment = EnvDefPartial & { handler: (msg: Message) => MessageConstructor; identity: () => EnvDef; }; export declare type RenderProps = { message: string; }; export declare type Renderer = (props: RenderProps) => any; /** * Creates an execution environment for a container by providing it with a set of effects * handlers and an effect dispatcher. * * @param {Map} effects A map pairing message classes to handler functions for that * message type. * @param {Function} dispatcher A message dispatcher function that accepts an effect * map, a container message dispatcher (i.e. the update loop), and a message to * dispatch. Should be a curried function. * @param {Function} stateManager A function that returns a new instance of `StateManager`. * @return {Object} Returns an environment object with the following functions: * - dispatcher: A curried function that accepts a container-bound message dispatcher * and a command message * - stateManager: A StateManager factory function * - identity: Returns the parameters that created this environment */ export declare const create: ({ effects, dispatcher, log, stateManager, displayError, }: EnvDef) => Environment; export declare const root: Environment; export declare const merge: (parent?: ExecContext | ExecContextPartial, env?: Environment) => Environment;