UNPKG

@fsmoothy/core

Version:

FSMoothy is a feature-rich and easy-to-use finite state machine for TypeScript.

27 lines 1.88 kB
import { _StateMachine } from './fsm'; import { AllowedNames, FsmContext, HistoryTypes, INestedStateMachine, INestedStateMachineParameters, NestedStateMachineConstructor, ParallelState } from './types'; type NestedStateMachineParent = _StateMachine<any, any, any>; export declare class _NestedStateMachine<const State extends AllowedNames, const Event extends AllowedNames, Context extends FsmContext<unknown>> extends _StateMachine<State, Event, Context> { protected _parent: NestedStateMachineParent | null; readonly type = "nested"; readonly history: HistoryTypes; constructor(parameters: INestedStateMachineParameters<State, Event, Context>, _parent?: NestedStateMachineParent | null); get context(): Context; } export declare const NestedStateMachine: NestedStateMachineConstructor; /** * Creates a nested state machine. * * @param machineParameters The parameters of the nested state machine. * @param options The options of the nested state machine. * @returns A nested state machine. */ export declare function nested<const State extends AllowedNames, const Event extends AllowedNames, Context extends FsmContext<unknown>>(machineParameters: INestedStateMachineParameters<State, Event, Context>): INestedStateMachine<State, Event, Context>; /** * Creates a parallel state. Parallel states execute all nested state machines at the same time. * * @param nested The nested state machines. */ export declare function parallel<NestedMachines extends ReadonlyArray<INestedStateMachine<State, Event, Context>>, const State extends AllowedNames = NestedMachines[number]['current'], const Event extends AllowedNames = NestedMachines[number]['events'][number], Context extends FsmContext<unknown> = NestedMachines[number]['context']>(...nested: NestedMachines): ParallelState<State, Event, Context>; export {}; //# sourceMappingURL=nested.d.ts.map