@thingts/fsm-engine - v1.2.1
    Preparing search index...

    Interface FsmEventBuilder<State, Events, Context, K>

    Builder used to define handling for a particular event within a state or fallback.

    Supports begin actions, guarded transitions, and unguarded transitions.

    interface FsmEventBuilder<
        State extends string,
        Events extends EventMap,
        Context,
        K extends EventName<Events>,
    > {
        begin(action: FsmBeginAction<State, Events, K, Context>): void;
        stay(
            body?: (
                t: FsmTransitionActionsBuilder<State, Events, Context, K>,
            ) => void,
        ): void;
        toState(
            target: State,
            body?: (t: FsmTransitionActionsBuilder<State, Events, Context, K>) => void,
        ): void;
        when(
            cond: FsmGuard<State, Events, K, Context>,
        ): FsmGuardedTransitionBuilder<State, Events, Context, K>;
    }

    Type Parameters

    Hierarchy

    Index

    Methods

    • Adds a begin action for this event handler.

      Begin actions run before any transition for the event is evaluated. Multiple begin actions are allowed and run in declaration order.

      See FsmBeginAction for the action function type signature.

      Parameters

      Returns void