* Clones this state machine with the provided implementations. * * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to * recursively merge with the existing options. * @returns A new `StateMachine` instance with the provided implementations.
(
implementations: InternalMachineImplementations<
ResolvedStateMachineTypes<
TContext,
DoNotInfer<TEvent>,
TActor,
TAction,
TGuard,
TDelay,
TTag,
TEmitted
>
>
)
| 182 | * @returns A new `StateMachine` instance with the provided implementations. |
| 183 | */ |
| 184 | public provide( |
| 185 | implementations: InternalMachineImplementations< |
| 186 | ResolvedStateMachineTypes< |
| 187 | TContext, |
| 188 | DoNotInfer<TEvent>, |
| 189 | TActor, |
| 190 | TAction, |
| 191 | TGuard, |
| 192 | TDelay, |
| 193 | TTag, |
| 194 | TEmitted |
| 195 | > |
| 196 | > |
| 197 | ): StateMachine< |
| 198 | TContext, |
| 199 | TEvent, |
| 200 | TChildren, |
| 201 | TActor, |
| 202 | TAction, |
| 203 | TGuard, |
| 204 | TDelay, |
| 205 | TStateValue, |
| 206 | TTag, |
| 207 | TInput, |
| 208 | TOutput, |
| 209 | TEmitted, |
| 210 | TMeta, |
| 211 | TStateSchema |
| 212 | > { |
| 213 | const { actions, guards, actors, delays } = this.implementations; |
| 214 | |
| 215 | return new StateMachine(this.config, { |
| 216 | actions: { ...actions, ...implementations.actions }, |
| 217 | guards: { ...guards, ...implementations.guards }, |
| 218 | actors: { ...actors, ...implementations.actors }, |
| 219 | delays: { ...delays, ...implementations.delays } |
| 220 | }); |
| 221 | } |
| 222 | |
| 223 | public resolveState( |
| 224 | config: { |
no outgoing calls