fromTransition() function​
Returns actor logic from a transition function and its initial state.
A transition function is a function that takes the current state and an event and returns the next state.
Signature:
export declare function fromTransition<TContext, TEvent extends EventObject, TSystem extends ActorSystem<any>, TInput>(transition: (state: TContext, event: TEvent, actorContext: ActorContext<TransitionSnapshot<TContext>, TEvent, TSystem>) => TContext, initialContext: TContext | (({ input, self }: {
input: TInput;
self: TransitionActorRef<TContext, TEvent>;
}) => TContext)): TransitionActorLogic<TContext, TEvent, TInput>;
Parameters​
Parameter | Type | Description |
---|---|---|
transition | (state: TContext, event: TEvent, actorContext: ActorContext<TransitionSnapshot<TContext>, TEvent, TSystem>) => TContext | The transition function that returns the next state given the current state and event. |
initialContext | TContext | (({ input, self }: { input: TInput; self: TransitionActorRef<TContext, TEvent>; }) => TContext) | The initial state of the transition function. |
Returns:
TransitionActorLogic<TContext, TEvent, TInput>
Actor logic