@fsmoothy/core
Version:
FSMoothy is a feature-rich and easy-to-use finite state machine for TypeScript.
23 lines • 934 B
TypeScript
import { AllowedNames, Callback, Guard, Transition, FsmContext } from './types';
export interface TransitionOptions<Context extends FsmContext<unknown>> {
onExit?: Callback<Context>;
onEnter?: Callback<Context>;
onLeave?: Callback<Context>;
guard?: Guard<Context>;
}
/**
* Creates a new transition.
*
* @param from - From state.
* @param event - Event name.
* @param to - To state.
* @param guard - Guard function.
*
* @overload
* @param from - From state.
* @param event - Event name.
* @param to - To state.
* @param options - Transition options.
*/
export declare const t: <const State extends AllowedNames, const Event extends AllowedNames, Context extends FsmContext<unknown> = FsmContext<unknown>>(from: ReadonlyArray<State> | State, event: Event, to: State, guardOrOptions?: Guard<Context> | TransitionOptions<Context>) => Transition<State, Event, Context>;
//# sourceMappingURL=transition.d.ts.map