import { MessageConstructor } from '../message'; import { Process } from '../subscription'; import ExecContext from './exec_context'; export declare type Callback = (...args: any[]) => any; export declare type Config = object & { path: (string | symbol)[]; }; export declare type Context = ExecContext; export default class StateManager { state: [object]; listeners: [any, Callback][]; processes: Map>; constructor(state?: object); /** * Gets the current state, optionally with a path into the root value. */ get(opts?: Config): unknown; /** * Pushes a new state value to the state container. Optionally accepts a path into * the root value to write into. */ set(newState: object, opts?: Config): object; /** * Updates the subscriptions attached to the container. */ run(context: Context, subs: Map, dispatch: any, config?: any): void; stop(context: Context, subs: Map, dispatch: any, config?: any): void; /** * Attaches a subscriber function that is invoked when the state is updated. Optionally * accepts an array representing a path into the root state value that this listener * should observe changes on. Returns an unsubscribe function. */ subscribe(listener: Callback, opts?: Config): () => any; protected broadcast: ([path, listener]: [any, any]) => any; /** * Returns an unsubscribe function for a listener. */ protected unsubscribeFn(listener: [any, Callback]): () => false | [any, Callback]; }